RunMat
GitHub

gcf — Return the current figure handle in MATLAB and RunMat.

gcf returns the handle of the figure currently selected for plotting operations. Handle creation/selection behavior follows MATLAB semantics with RunMat figure management.

Syntax

fig = gcf()

Returns

NameTypeDescription
figNumericScalarCurrent figure handle.

How gcf works

  • gcf() returns a scalar numeric figure handle.
  • The value changes after commands like figure(n) or figure('next') select a different figure.
  • Subsequent plotting commands target the same current figure until another figure is selected.

Does RunMat run 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 = 2

Observe the handle change after selecting a different figure

figure(1);
f1 = gcf();
figure(4);
f2 = gcf();

Expected output:

f1 = 1
f2 = 4

Using gcf with coding agents

Open a RunMat example with live inputs, then ask the agent to explain how gcf changes the result.

Run a small gcf example, explain the result, then change one input and compare the output.

FAQ

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.

2D Charts

area · bar · errorbar · heatmap · hist · histogram · loglog · pie · plot · scatter · semilogx · semilogy · stairs · stem

3D & Surface

contour · contour3 · contourf · mesh · meshc · plot3 · quiver · scatter3 · surf · surfc

Images

image · imagesc · imshow

Axes & Layout

axis · box · grid · sgtitle · subplot · title · view · zlabel

Appearance

colorbar · colormap · legend · shading

Handle Access

gca · get · set

Other

cla · clf · figure · fill3 · hold · patch · print · suptitle · xline · yline

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how gcf is executed, line by line, in Rust.

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.

  • RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
  • Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.