by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Visualization
Introduced first in SolidGeometry 5.1, Creation date: 2021-12-05, Last change: 2025-08-18
popgcf
SGfigure; SGbox; pushgcf; CPSplot(PLcircle(30)); pause(1); popgcf;
This function, popgcf, is part of the SolidGeometry library and is used to manage graphics objects in MATLAB figures. It is particularly useful when recording all handles is not feasible.
The function popgcf does not take any input parameters directly. Instead, it relies on global variables and the current figure context.
pushgcfhandle: A global variable that stores handles of graphics objects that should be retained in the current figure.pushgcftitle: A global variable that stores the title to be set for the current figure.findobj(gcf).pushgcfhandle using setdiff.delete(delh).pushgcftitle using title(pushgcftitle).The function is typically used in a sequence of commands to manage figure content:
SGfigure; SGbox; pushgcf; CPSplot(PLcircle(30)); pause(1); popgcf;
In this example, a figure is created, a box is drawn, and the current state is saved with pushgcf. After plotting a circle and pausing, popgcf is called to restore the figure to its previous state.