gcf — Return the numeric handle of the current figure.
gcf returns the numeric handle of the figure that is currently selected for plotting operations.
How gcf works
gcf()returns a scalar numeric figure handle.- The value changes after commands like
figure(n)orfigure('next')select a different figure. - Subsequent plotting commands target the same current figure until another figure is selected.
How RunMat runs gcf on the GPU
gcf performs no provider dispatch; it simply reads the current figure handle from plotting state.
GPU memory and residency
gcf returns a host-side numeric handle and does not interact with GPU residency.
Examples
Read the current figure handle
figure(2);
f = gcf()Expected output:
f = 2Observe the handle change after selecting a different figure
figure(1);
f1 = gcf();
figure(4);
f2 = gcf();Expected output:
f1 = 1
f2 = 4FAQ
What type of value does gcf return?
It returns a scalar double representing the current figure handle.
Does gcf create a plot?
No. It only reports which figure is currently selected.
Does gcf run on the GPU?
No. It only reads host-side plotting state.
Related Plotting functions
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how gcf works, line by line, in Rust.
- View gcf.rs on GitHub
- Learn how the runtime works
- Found a bug? Open an issue with a minimal reproduction.
About RunMat
RunMat is an open-source runtime that executes MATLAB-syntax code — faster, on any GPU, with no license required.
- Simulations that took hours now take minutes. RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed.
- Start running code in seconds. Open the browser sandbox or download a single binary. No license server, no IT ticket, no setup.
- A full development environment. GPU-accelerated 2D and 3D plotting, automatic versioning on every save, and a browser IDE you can share with a link.