I wrote a GUI program, in which the zoom operation was frequently used. So I defined a KerPressFcn “ctrl+=” which was the "zoom on" operation. See the following function myfunc1.
But how should I define a shortcut to exit zoom mode? It seems that zoom off in the function just doesn't work.
But in the other hand, in the command window, if input
a figure shows. Then in the command window, input
the cursor is in zoom mode in the figure;
Back in the command window, type
then in the figure, the cursor exits the zoom mode.
Why did NOT the same command zoom off in my own function work?
My own function: (I revised the code to be more specific)
fig.KeyPressFcn = @zoomKeys;
hAxes = axes(fig);
function zoomKeys(~, event)
if strcmp(event.Modifier, 'control')
if ~strcmpi(event.Key, 'equal')