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

1

6

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;
Kilderkin answered 4/10, 2016 at 21:16 Comment(1)
I can recreate your bug. However, when running your example with createFig1 = 0, I can only do 5-10 interactions with the figure before the figure window hangs. Reading the comments on the links you provide, I get the impression that pause now pauses the GUI by design, and being able to do 5-10 interactions is the buggy behavior...Joub
H
1

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.

Hellgrammite answered 16/10, 2016 at 15:57 Comment(2)
This is sad, can you point out references for your affirmations?Kilderkin
Yep, I actually work at MathWorks, and this has been a known bug. It was fixed in R2016b.Hellgrammite

© 2022 - 2024 — McMap. All rights reserved.