User`s guide
CodetheSimpleProgrammaticGUI
% Create and then hide the GUI as it is being constructed.
f = figure('Visible','off','Pos ition',[360,500,450,285] );
% Construct the components.
hsurf = uicontrol('Style','push button','String','Surf', ...
'Position',[315,220,70,25],...
'Callback',{@surfbutton_Callback});
hmesh = uicontrol('Style','push button','String','Mesh', ...
'Position',[315,180,70,25],...
'Callback',{@meshbutton_Callback});
hcontour = uicontrol('Style','p ushbutton',...
'String','Countour',...
'Position',[315,135,70,25],...
'Callback',{@contourbutton_Callback});
htext = uicontrol('Style','text ','String','Select Data',...
'Position',[325,90,60,15]);
hpopup = uicontrol('Style','pop upmenu',...
'String',{'Peaks','Membrane','Sinc'},.. .
'Position',[300,50,100,25],...
'Callback',{@popup_menu_Callback});
ha = axes('Units','Pixels','Pos ition',[50,60,200,185]);
align([hsurf,hmesh,hcontour,htext,hp opup],'Center','None');
% Create the data to plot.
peaks_data = peaks(35);
membrane_data = membrane;
[x,y] = meshgrid(-8:.5:8);
r = sqrt(x.^2+y.^2) + eps;
sinc_data = sin(r)./r;
% Initialize the GUI.
% Change units to normalize d so components res ize
% automatica lly.
set([f,ha,hsurf,hmesh,hcontour,htext ,hpopup],...
'Units','normalized');
%Create a plot in the axes.
current_data = peaks_data;
surf(current_data);
% Assign the GUI a name to appear in the window title.
3-17