How to clear (not close) all the opened figures?
Show older comments
I would like to ask what is the easiest way to clear all the figures (not closing them) already opened.
The "clf" command is useful, but it clears only the current figure.
Is there a command or some easy instruction to clear all figures, such as "close all" used for closing them?
1 Comment
Stephen23
on 3 Sep 2019
The shotgun approach is a bad way to write code. Avoid doing this.
"I would like to ask what is the easiest way to clear all the figures"
The simplest solution is to write more robust code: put all of the figure handles into one array, then looping over them is trivially easy and very efficient.
Accepted Answer
More Answers (1)
Masoud Aliramezani
on 19 Feb 2020
8 votes
Quite surprising that MATLAB doesn't have something like "clf all". Perhaps that's something to look at for the next updates.
Categories
Find more on Shifting and Sorting Matrices in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!