File Exchange

image thumbnail

Close all figures except specific (previously tagged) ones

version (1.4 KB) by Valerio Biscione
You can tag some figures to be "kept" when, later, you will call a function to close all the figures


Updated 27 Feb 2015

View License

This is a variant of "close all figures except those listed" (
In this version you first tag the figures that you want to keep. Then, at anytime during the code, you can close all the figures but the tagged one by calling "cluk" (close all unkept).
For example, let's say you have 6 figure, 1 2 3 10 13 50.
with keepFig([3 10]) you will tag figure 3 and 10. This will not change the appearance of the figures in anyway.
At anypoint in the code, you can call cluk, which will close all the figures except figure 3 and 10.
You can untag all the figures by calling keepFig(-Inf). You can untag a specific figure by calling the negative of that figure's number (for example, if you want to untag figure 3, call keepFig(-3)).
You can tag all the figures by calling keepFig(Inf).

Comments and Ratings (0)


changed title

MATLAB Release Compatibility
Created with R2014b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: Close all figures except those listed

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.

Learn About Live Editor