I have a script that creates multiple uifigures:
% create fig1
fig1 = uifigure('Name', 'Figure 1');
% create fig2
fig2 = uifigure('Name', 'Figure 2');
% set fig2 as the current figure
set(0, 'currentfigure', fig2);
% get the current figure
gcf
I want the second uifigure to be the current one, so I set it with the third command. However, when I then use gcf
to get the current figure, it is still the first one. Here is the output from the command line:
ans =
Figure (1) with properties:
Number: 1
Name: ''
Color: [0.9400 0.9400 0.9400]
Position: [514 371 560 420]
Units: 'pixels'
Show all properties
What is the problem?