how to re enable control to press tab key for windowbuttondownfcn event after plotting in matlab

To re-enable the ability to press the tab key in a WindowButtonDownFcn event after plotting in MATLAB, you can reset the 'Interruptible' property of the figure to 'on'. This will allow the figure to respond to key presses even during execution of other callbacks.

Here is an example of how you can do this:

main.m
% Create a figure
figure;
plot(1:10);

% Set the WindowButtonDownFcn
set(gcf, 'WindowButtonDownFcn', @myCallback);

% Disable interruption of callbacks
set(gcf, 'Interruptible', 'off');

% Perform your plotting or other operations

% Re-enable interruption of callbacks
set(gcf, 'Interruptible', 'on');

% Define the callback function
function myCallback(src, event)
    disp('Mouse button clicked!');
end
406 chars
20 lines

By setting the 'Interruptible' property to 'on' after your plotting operations, the figure will be able to respond to the tab key press or any other callback events.

related categories

gistlibby LogSnag