Sometimes you need a fresh figure, but you want to control/save the figure number. This script retrieves the list of opened figure windows and finds n_requested unused figure numbers.
This code is written to be portable over OS (Windows/Mac/Unix) and platform (Matlab/Octave). It should work on just about any version.
Rik (2021). getfignum(n_requested) (https://www.mathworks.com/matlabcentral/fileexchange/61505-getfignum-n_requested), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!