MATLAB: GUI Question: How to import a variable/vector/matrix into a GUI I created

matlab gui

Hi! For example, I am creating my own GUI and I want to Import a variable or a vector from workspace or file system? How do I go about doing this? Thanks very much!

Best Answer

If you want to access data that is in base workspace in your gui functions, use
v = evalin('base','name of variable u want to access'); % the variable's data is now stored in v. If u want to save data of ur gui work space to base, use
assignin('base','name of variable u want to save','value of variable'); Several ways are shared in the FAQ: http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.28s.29.3F