Plot Workspace Variables in a GUIDE UI
To get and view the example code:
1 Copy the example FIG-file and code file to your current (writeable) folder and open
the FIG-file in GUIDE with the following commands:
copyfile(fullfile(docroot, 'techdoc','creating_guis',...
'examples','lb.*')), fileattrib('lb.*', '+w')
guide lb.fig
(^2) From GUIDE Layout Editor, click the Editor button.
The lb.m code displays in the MATLAB Editor.
Read Workspace Variables
When the UI initializes, it queries the workspace variables and sets the list box String
property to display these variable names. Adding the following local function to the UI
code, lb.m, accomplishes this using evalin to execute the who command in the base
workspace. The who command returns a cell array of strings, which are used to populate
the list box.