User`s guide
10 Examples of GUIDE GUIs
end
% Plot data
pHandles = plot(PlotData{:},'Parent',handles.PlotAxes);
% Add a legend, and bring figure to the front
legend(pHandles(1:2:end),legendStr{:})
% Make the figure visible and bring it forward
figure(handles.PlotFigure)
The GUI Help Button
The GUI Help button callback displays an HTML file in the M ATLAB Help
browser. It uses two commands:
• The
which command returns the full path to the file when it is on the
MATLAB path
• The
web commanddisplaysthefileintheHelpbrowser.
This is the Help button callback.
function HelpBu tton _Callback(hObject, eventdata, handles)
HelpPath = which('f14ex_help.ht ml');
web(HelpPath);
You can also display the help document in a W eb browser or load an external
URL. For a description of the se options, see the documentation for the
web
function.
Close the GUI
The GUI Close button callback closes the plot figure, if one exists and then
closes the GUI. The handle of the plot figure and the GUI figure are available
from the
handles structure. The callback executes two steps:
• Checks to see if there is a
PlotFigure field in the handles structure and
if it contains a valid figure handle (the user could have closed the figure
manually).
• Closes the GUI figure.
This is the Close button callback:
10-78