RunMat
GitHub

gca — Return the handle for the current axes, or a struct describing the active axes state.

gca returns the encoded handle for the current axes. RunMat also supports a 'struct' mode that returns a small struct snapshot describing the active figure, subplot grid, and selected axes index.

How gca works

  • gca() returns a scalar numeric axes handle.
  • gca('struct') returns a struct with fields handle, figure, rows, cols, and index.
  • The current axes reflect the active subplot when subplot has been used.
  • Unsupported arguments raise gca plotting errors.

How RunMat runs gca on the GPU

gca performs no provider dispatch; it only reads the active axes state from the plotting registry.

GPU memory and residency

gca returns host-side handles or structs and does not interact with GPU residency.

Examples

Read the current axes handle

figure(1);
ax = gca()

Expected output:

% ax is a numeric axes handle

Inspect the active subplot layout

subplot(2, 2, 3);
info = gca("struct")

Expected output:

info =
  struct with fields:
    handle
    figure
    rows
    cols
    index

FAQ

What is special about gca('struct')?

It is a RunMat extension that returns a struct snapshot of the active axes state instead of just the encoded numeric handle.

Does gca reflect subplot selection?

Yes. When a subplot is active, gca reports that subplot's axes handle and metadata.

Does gca run on the GPU?

No. It only reads host-side plotting state.

2D Charts

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

3D & Surface

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

Images

image · imagesc

Axes & Layout

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

Appearance

colorbar · colormap · legend · shading

Handle Access

get · set

Other

cla · clf · figure · gcf · hold · imshow · title

Open-source implementation

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

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.

Getting started · Benchmarks · Pricing

Try RunMat for free

Open the sandbox and start running MATLAB code in seconds. No account required.