Issue with figure display

14 views (last 30 days)
Turbulence Analysis
Turbulence Analysis on 10 Mar 2022
Hi,
I have used below command inside the for loop to avoid the display of figures. However, if I run some other command even in new editor page there is no figure display at all. And also, the new figures are always overlapping with the previous ones..
This problem is getting rectified only if I restart the Matlab..
I seriuosly don't know what's happening with this command,, Any help please ??
set(0,'DefaultFigureVisible','off')

Accepted Answer

Rik
Rik on 10 Mar 2022
The command you posted will set the default visibility property to off. That means that a new figure that is created will have its visibility turned off. This setting affects every figure creation in Matlab.
You should change the code in your loop to create the figures with their visibility off instead.
If that is not possible, you should restore the default when you're done.
DefaultFigureVisible=get(0,'DefaultFigureVisible');
set(0,'DefaultFigureVisible','off')
% rest of your code
set(0,'DefaultFigureVisible',DefaultFigureVisible)
  8 Comments
Rik
Rik on 10 Mar 2022
That is what I suggested as well (as the preferred solution actually): if create new figures in your loop, you should set the Visible property then.
for n=1:10
f(n)=figure('Visible','off');
ax=axes('Parent',f(n));
plot(rand(10,1),'Parent',ax)
title(sprintf('n=%d',n))
end
set(f(randi(end)),'Visible','on')

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!