make dialogue box wait for previous figure to be closed

6 Ansichten (letzte 30 Tage)
Isobel Leikis
Isobel Leikis am 4 Mai 2022
Kommentiert: Voss am 5 Mai 2022
I = imread('END_OF_YEAR Gameboard.jpg');
imshow(I);
% question 1
% generate a random integer value for x between 1 and 100
x = randi([1 100]);
% asks a question and waits for user input
prompt1= 'x+4';
ans1 = inputdlg(sprintf("when x = %i \nWhat is x+4?",x));
% i would like for the dialogue box to wait for the image to be closed before appearing, thank you!

Akzeptierte Antwort

Voss
Voss am 4 Mai 2022
I = imread('END_OF_YEAR Gameboard.jpg');
f = figure();
imshow(I);
uiwait(f); % wait for the image to be closed before proceeding
% question 1
% generate a random integer value for x between 1 and 100
x = randi([1 100]);
% asks a question and waits for user input
prompt1= 'x+4';
ans1 = inputdlg(sprintf("when x = %i \nWhat is %s?",x,prompt1));

Weitere Antworten (0)

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by