figureisopen

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

returns of there is already a graphics window open



See Also: gcfSG , copyplot , smbdrawnow , pushgcf , popgcf , pastego , copyfig , snapplot

Example Illustration

 missing image of figureisopen

Syntax

io=figureisopen

Output Parameter

io: is open => true

Examples


close all; figureisopen
gcfSG




Copyright 2022-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Algorithm (Workflow)

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.

Input Parameters

The function does not take any input parameters.

Output

Algorithm Explanation

The function uses the following steps to determine if a graphics window is open:

  1. It calls get(groot, 'Children') to retrieve the list of all open figure windows.
  2. It checks if this list is empty using isempty.
  3. The result is negated with ~ to set io to true if there are any open figures, and false otherwise.

Additional Code Comments

The commented-out code suggests an alternative method to determine if a figure is open by comparing the positions of two figures:

  1. Create a new figure b and compare its position with the current figure a.
  2. If their positions are not equal, it implies that a figure is open.
  3. Close the newly created figure b.
  4. If no figure was open initially, close the current figure a.
Algorithm explaination created using ChatGPT on 2025-08-18 22:53. (Please note: No guarantee for the correctness of this explanation)

Last html export of this page out of FM database by TL: 2025-09-21