Axes, Menus, and Toolbars in Programmatic UIs
You can select other plots in the pop-up menu. Clicking the Update button displays the
currently selected plot on the axes.
The File menu has three options:
- Open displays a dialog from which you can open files on your computer.
- Print opens the Print dialog. Clicking Yes in the Print dialog prints the plot.
- Close closes the window.
The toolbar has two buttons:
- The Open button performs the same function as the Open menu option. It displays
a dialog from which you can open files on your computer.
- The Print button performs the same function as the Print menu option. It opens
the Print dialog. Clicking Yes in the Print dialog prints the plot.
View the Example Code
Follow these steps to get copies of the example files:
1 Set your current folder to one to which you have write access.
2 Copy the example code and display the example code files in the Editor by executing
these MATLAB commands:
copyfile(fullfile(docroot, 'techdoc','creating_guis',...
'examples','axesMenuToolbar.m')),...
fileattrib('axesMenuToolbar.m', '+w');
copyfile(fullfile(docroot, 'techdoc','creating_guis',...
'examples','iconRead.m')),fileattrib('iconRead.m', '+w');
edit axesMenuToolbar.m
edit iconRead.m
Generate the Graphing Commands and Data
The program file, axesMenuToolbar.m, defines two variables mOutputArgs and
mPlotTypes.
mOutputArgs is a cell array that holds output values that are optionally returned by the
function.
mOutputArgs = {};