gcf
Returns the handle of the current figure, creating one if needed.
Category: Graphics > Graphics Objects
Syntax
fig = gcf
Returns the current figure.
Description
The current figure is the one that new plots draw into. It is the most recently created or selected figure. If none exists, gcf creates an empty one, so calling it can have the side effect of making a figure.
Output arguments
fig- Figure object; use it with
get,set,saveasorclose.
Example
Name the current figure
f = figure;
plot(1:3)
set(gcf, 'Name', 'demo')
disp(get(gcf, 'Name'))
disp(gcf == f)
Output
demo
1