MATLAB Creating Graphical User Interfaces

(Barry) #1
Axes, Menus, and Toolbars in Programmatic UIs

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 closes the window.


Updating the Plot


Here is the code for the localUpdatePlot function. Because it is a nested function,
localUpdatePlot has access to the same data and UI components as the other callback
functions.


function localUpdatePlot
% Helper function for plotting the selected plot type
mPlotTypes{hPlotsPopupmenu.Value, 2}(hPlotAxes);
end


The localUpdatePlot function gets 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,
localUpdatePlot calls the corresponding anonymous function from the second column
in the cell array.


See Also
Axes Properties | Figure Properties | Uicontrol Properties


More About



  • “Anonymous Functions”

Free download pdf