Current figure handle
Specify Properties for Current Figure
Set the background color and remove the toolbar
for the current figure. Use the
gcf command to
get the current figure handle.
surf(peaks) fig = gcf; % current figure handle fig.Color = [0 0.5 0.5]; fig.ToolBar = 'none';
The current figure is the target for graphics
output. It is the figure window in which graphics commands such as
surf draw their results. It is typically the
last figure created or the last figure clicked with the mouse.
User interaction can change the current figure. If you need
to access a specific figure, store the figure handle in your program
code when you create the figure and use this handle instead of
To get the handle of the current figure without forcing the creation of a figure if one does not exist, query the
CurrentFigureproperty on the root object.MATLAB® returns
fig = get(groot,'CurrentFigure');
figas an empty array if there is no current figure.
Introduced before R2006a