Search Contact information
University of Cambridge Home Department of Engineering
University of Cambridge >  Engineering Department >  computing help
next up previous contents
Next: Program-generated names and commands Up: Examples Previous: Making holes

Adding buttons and menus

One of the properties of graphical objects (called ButtonDownFcn) describes what happens if there's a mouse click on the object, thus permitting complex user-interaction.

% This displays a simple figure and some buttons 
% It needs a command called rotating to work
uicontrol('style','pushbutton','string','rotate',...
'ButtonDownFcn','rotating','Enable','off');
mesh(peaks(10))

Put this code into rotating.m

% rotaing.m
[az, el ] = view;
az=az+45;
view(az, el)



© Cambridge University Engineering Dept
Information provided by Tim Love
2006-07-24