MATLAB Creating Graphical User Interfaces

(Barry) #1

3 A Simple Programmatic UI


end

function meshbutton_Callback(source,eventdata)
% Display mesh plot of the currently selected data.
mesh(current_data);
end

function contourbutton_Callback(source,eventdata)
% Display contour plot of the currently selected data.
contour(current_data);
end
end
2 Run your code by typing simple_gui2 at the command line. The initialization code
causes it to display the default peaks data with the surf function, making the UI
look like this.

3 In the pop-up menu, select Membrane, and then click the Mesh button. The UI
displays a mesh plot of the MathWorks L-shaped Membrane logo.
4 Try other combinations before closing the UI.
5 Type help simple_gui2 at the command line. MATLAB software displays the help
text.
Free download pdf