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 fieldshandle,figure,rows,cols, andindex.- The current axes reflect the active subplot when
subplothas been used. - Unsupported arguments raise
gcaplotting 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 handleInspect the active subplot layout
subplot(2, 2, 3);
info = gca("struct")Expected output:
info =
struct with fields:
handle
figure
rows
cols
indexFAQ
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.
Related Plotting functions
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how gca works, line by line, in Rust.
- View gca.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.