User`s guide
6 Lay Out a GUIDE GUI
% hObject handle to togglebutton1 (see GCBO)
% eventdata re serv ed - to be defi ned in a future ver sion of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle st ate of togglebutton1
isDown = get(hObject,'Value');
if isDown
set(handles.textStatus, 'string', 'Toggle down')
else
set(handles.textStatus, 'string', 'Toggle up')
end
The if block tests the variable isDown, which has been set to the Value
property of the toggle button, and writes a different message depending on
whether the value is true or false.
The Plot Controls. The two components of the Plot Controls panel affect
the plot of the
peaks fu n c tion as well as rewrite the text in the Action Panel.
• A popup menu to select a built-in colormap by name
• A slider to rotate the view around the z-axis
The popup, named
popupmenu1, contains a list of seven colormap names in its
String property, which you can set in the P roperty Inspector by clicking its
Edit icon
. Typing the strings into the edit dialog and clicking OK sets
all seven colormap names at once.
6-28