by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Visualization
Introduced first in SolidGeometry 5.1, Creation date: 2022-01-06, Last change: 2025-08-18
See Also: gcfSG
, copyplot
, smbdrawnow
, pushgcf
, popgcf
, pastego
, copyfig
, snapplot
io=figureisopen
io: | is open => true |
close all; figureisopen
gcfSG
This function, figureisopen, determines if there is an open graphics window in MATLAB. It is part of the SolidGeometry library and was introduced in version 5.1.
The function does not take any input parameters.
io: A boolean value indicating if a graphics window is open. Returns true if a window is open, otherwise false.The function uses the following steps to determine if a graphics window is open:
get(groot, 'Children') to retrieve the list of all open figure windows.isempty.~ to set io to true if there are any open figures, and false otherwise.The commented-out code suggests an alternative method to determine if a figure is open by comparing the positions of two figures:
b and compare its position with the current figure a.b.a.