
GUI with Axes, Menu, and Toolbar
12-21
if strcmp(selection,'No')
return;
end
delete(hMainFigure);
end
The hCloseMenuitemCallback function calls the questdlg function to create
and open the question dialog box shown in the following figure.
If the user clicks the
No button, the callback returns. If the user clicks the Yes
button, the callback deletes the GUI.
See “Helper Function: Plotting the Plot Types” on page 12-21 for a description
of the
localUpdatePlot function.
Helper Function: Plotting the Plot Types
The example defines the localUpdatePlot function at the same level as the
callback functions. Because of this,
localUpdatePlot has access to the same
data and component handles.
function localUpdatePlot
% Helper function for plotting the selected plot type
mPlotTypes{get(hPlotsPopupmenu, 'Value'), 2}(hPlotAxes);
end
The localUpdatePlot function uses the pop-up menu Value property to
identify the selected menu item from the first column of the
mPlotTypes 5-by-2
cell array, then calls the corresponding anonymous function from column two
of the cell array to create the plot in the axes.
Kommentare zu diesen Handbüchern