Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Matlab R2016a bug - unable to interact with figure when waiting for user input

In Matlab R2016a while waiting for a user input or paused I'm unable to interact with figure controls, like zoom. This doesn't happen in older Matlab versions.

This only happens when a figure was created before and also CLOSED. Run the code below using createFig1 = 0; (no bug) and createFig1 = 1; (bug).

Bug will NOT happen if:

  • Fig1 is not created
  • Fig1 is created but not closed
  • Pause is removed

Similar problem also reported here and here.

Sample code:

clearvars; close all;

% If fig1 is created here AND closed, zoom control in fig2 becames unresponsible !
createFig1 = 1;
if createFig1
    fig1=figure;
    title('Press any key or click to continue...');
    disp('Press any key or click to continue...');
    k = waitforbuttonpress;
    close(fig1); clear fig1;
end

%fig2=figure('units','normalized','outerposition',[0 0 1 1]);
fig2=figure;
plot(randn(1000,1));
title('Fig A');

% #### Bug here if fig1 was created and closed !!!! ####
% #### zoom control gets unresponsible !! ####
disp('Zoom in/out and press any key to select points...')
pause;
like image 993
Pedro77 Avatar asked Oct 04 '16 21:10

Pedro77


1 Answers

If you are looking for a workaround, there is none.

This is a bug in MATLAB R2016a, and has been fixed in MATLAB R2016b.

Unfortunately, if this is a critical issue for you, I recommend either downgrading or upgrading your MATLAB, and it should be fine.

like image 96
Samarth Shah Avatar answered Oct 20 '22 14:10

Samarth Shah