28.12.2012 Views

Figure Properties - SERC

Figure Properties - SERC

Figure Properties - SERC

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Figure</strong> <strong>Properties</strong><br />

2-786<br />

Field Contents<br />

Character The character displayed as a result of the key(s)<br />

pressed.<br />

Modifier This field is a cell array that contains the names of<br />

one or more modifier keys that the user pressed<br />

(i.e., Control, Alt, Shift).<br />

Key The key pressed (lower case label on key)<br />

Some key combinations do not define a value for the Character field.<br />

Using the KeyPressFcn<br />

This example, creates a figure and defines a function handle callback for the<br />

KeyPressFcn property. When the "e" key is pressed, the callback exports the<br />

figure as an EPS file. When Ctrl-t is pressed, the callback exports the figure as<br />

a TIFF file.<br />

function figure_keypress<br />

figure('KeyPressFcn',@printfig);<br />

function printfig(src,evnt)<br />

if evnt.Character == 'e'<br />

print ('-deps',['-f' num2str(src)])<br />

elseif length(evnt.Modifier) == 1 & strcmp(evnt.Modifier{:},<br />

'control') & evnt.Key == 't'<br />

print ('-dtiff','-r200',['-f' num2str(src)])<br />

end<br />

See Function Handle Callbacks for information on how to use function handles<br />

to define the callback function.<br />

MenuBar none | {figure}<br />

Enable-disable figure menu bar. This property enables you to display or hide<br />

the menu bar that MATLAB places at the top of a figure window. The default<br />

(figure) is to display the menu bar.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!