RunMat
  • Pricing
RunMat
GitHub
GitHub
Sign inTry in browser
DesktopRuntimePhysicsCADAdministrationAgent

Get RunMat updates

New releases, guides and examples.

Product+
  • Runtime
  • GPU
  • Parallel
  • Compile
  • Interop and MEX
  • Simulation
  • MCAD
  • ECAD
  • Enterprise
  • AI integrations
  • Pricing
  • Download
Math+
  • Signal processing
  • Linear algebra
  • Statistics
  • Curve fitting
  • Differential equations
  • Control systems
  • Optimization
  • Finance
  • Data and tables
  • Plotting
Physics+
  • Simulation overview
  • Structural
  • Thermal
  • Electromagnetic
  • Joule heating
  • Thermal stress
  • Acoustics
  • Fluid flow
  • Conjugate heat transfer
  • Fluid–structure
  • What is FEA
Industries+
  • Aerospace
  • Automotive and transportation
  • Defense
  • Electronics and semiconductors
  • Energy
  • Industrial machinery
  • Life sciences
  • Quantitative finance
Learn+
  • Guides
  • Docs
  • Function reference
  • Language reference
  • Migration guide
  • Changelog
  • MATLAB Online
  • MATLAB AI agent
  • For students
Compare+
  • RunMat vs MATLAB
  • RunMat vs Ansys
  • RunMat vs SOLIDWORKS
  • RunMat vs Altium
  • RunMat vs Cadence
  • RunMat vs COMSOL
  • RunMat vs Python
  • RunMat vs Julia
  • RunMat vs Physics AI
  • RunMat vs Octave
  • Benchmarks
  • MATLAB alternatives
  • All comparisons
Company+
  • About
  • Blog
  • Contact
  • Source code↗
  • License
  • Privacy
  • Terms

Product

  • Runtime
  • GPU
  • Parallel
  • Compile
  • Interop and MEX
  • Simulation
  • MCAD
  • ECAD
  • Enterprise
  • AI integrations
  • Pricing
  • Download

Math

  • Signal processing
  • Linear algebra
  • Statistics
  • Curve fitting
  • Differential equations
  • Control systems
  • Optimization
  • Finance
  • Data and tables
  • Plotting

Physics

  • Simulation overview
  • Structural
  • Thermal
  • Electromagnetic
  • Joule heating
  • Thermal stress
  • Acoustics
  • Fluid flow
  • Conjugate heat transfer
  • Fluid–structure
  • What is FEA

Industries

  • Aerospace
  • Automotive and transportation
  • Defense
  • Electronics and semiconductors
  • Energy
  • Industrial machinery
  • Life sciences
  • Quantitative finance

Learn

  • Guides
  • Docs
  • Function reference
  • Language reference
  • Migration guide
  • Changelog
  • MATLAB Online
  • MATLAB AI agent
  • For students

Compare

  • RunMat vs MATLAB
  • RunMat vs Ansys
  • RunMat vs SOLIDWORKS
  • RunMat vs Altium
  • RunMat vs Cadence
  • RunMat vs COMSOL
  • RunMat vs Python
  • RunMat vs Julia
  • RunMat vs Physics AI
  • RunMat vs Octave
  • Benchmarks
  • MATLAB alternatives
  • All comparisons

Company

  • About
  • Blog
  • Contact
  • Source code↗
  • License
  • Privacy
  • Terms
GitHubXLinkedIn

© Dystr, Inc. · RunMat v0.7.1, Nov 17, 2026

RunMat® is a registered trademark of Dystr, Inc. MATLAB® is a registered trademark of The MathWorks, Inc. RunMat is not affiliated with, endorsed by, or sponsored by The MathWorks, Inc.

/
See all docs
Builtin Reference
    • addpoints
    • ancestor
    • animatedline
    • area
    • autumn
    • axes
    • axis
    • bar
    • barh
    • bone
    • box
    • caxis
    • cla
    • clf
    • clim
    • colorbar
    • colorcube
    • colormap
    • colororder
    • contour
    • contour3
    • contourf
    • cool
    • copper
    • copyobj
    • cylinder
    • daspect
    • datacursormode
    • dataTipTextRow
    • drawnow
    • errorbar
    • fcontour
    • figure
    • fill
    • fill3
    • findobj
    • fsurf
    • gca
    • gcf
    • get
    • gobjects
    • gray
    • grid
    • groot
    • heatmap
    • hgload
    • hgsave
    • hidden
    • hist
    • histogram
    • histogram2
    • hold
    • hot
    • image
    • imagesc
    • imshow
    • inferno
    • isgraphics
    • ishandle
    • jet
    • legend
    • line
    • lines
    • linkaxes
    • loglog
    • magma
    • mesh
    • meshc
    • openfig
    • opengl
    • pan
    • parula
    • patch
    • pie
    • pink
    • plasma
    • plot
    • plot3
    • plotmatrix
    • plotyy
    • polarhistogram
    • polarplot
    • polarscatter
    • print
    • quiver
    • quiver3
    • ribbon
    • saveas
    • savefig
    • scatter
    • scatter3
    • semilogx
    • semilogy
    • set
    • sgtitle
    • shading
    • sphere
    • spring
    • stackedplot
    • stairs
    • stem
    • subplot
    • subtitle
    • summer
    • suptitle
    • surf
    • surfc
    • text
    • textscatter
    • textscatter3
    • title
    • triplot
    • turbo
    • view
    • viridis
    • waitbar
    • winter
    • wordcloud
    • xlabel
    • xlim
    • xline
    • xscale
    • xtickangle
    • xtickformat
    • xticklabels
    • xticks
    • ylabel
    • ylim
    • yline
    • yscale
    • ytickangle
    • ytickformat
    • yticklabels
    • yticks
    • zlabel
    • zlim
    • zoom

copyobj — Copy plot-child graphics objects to a compatible axes parent.

copyobj duplicates supported graphics objects and returns fresh graphics handles. MATLAB's public inputs are graphics objects rather than integer data. RunMat currently supports plot-child object copies, including line, scatter, bar, stairs, stem, area, quiver, image, heatmap, binscatter, surface, patch, line3, scatter3, contour, fcontour, fsurf, constant-line, pie, and histogram-backed plot children.

Syntax

hnew = copyobj(h, parent)

Inputs

h
Type
Any
Required
Yes
Description
Graphics object handle or handle array to copy.
parent
Type
Any
Required
Yes
Description
Destination axes handle compatible with the plot child.
NameTypeRequiredDefaultDescription
hAnyYes—Graphics object handle or handle array to copy.
parentAnyYes—Destination axes handle compatible with the plot child.

Returns

hnew
Type
NumericArray
Description
Copied graphics object handle or handle array.
NameTypeDescription
hnewNumericArrayCopied graphics object handle or handle array.

Errors

RunMat:copyobj:InvalidArgument
When
Argument count, source handle, or target parent handle is invalid or unsupported.
Message
copyobj: invalid argument
RunMat:copyobj:Internal
When
Internal graphics state lookup or copy registration fails.
Message
copyobj: internal operation failed
RunMat:copyobj:TooManyOutputs
When
More than 1 output arguments are requested.
Message
copyobj: too many output arguments
IdentifierWhenMessage
RunMat:copyobj:InvalidArgumentArgument count, source handle, or target parent handle is invalid or unsupported.copyobj: invalid argument
RunMat:copyobj:InternalInternal graphics state lookup or copy registration fails.copyobj: internal operation failed
RunMat:copyobj:TooManyOutputsMore than 1 output arguments are requested.copyobj: too many output arguments

Behavior

copyobj(h, parent) copies each plot-child handle in h to a compatible axes parent. Plot children such as lines do not accept a figure or panel as their destination parent.

Copied objects are inserted into the destination axes identified by parent.

A scalar parent is applied to every source handle; equal-length source and parent vectors copy each source into the corresponding parent regardless of row/column orientation; a scalar source can be copied into each parent in a parent array. Existing RunMat matrix and N-D handle arrays pair in linear storage order with equal element counts, without claiming MATLAB matrix-form parity.

Handle arrays preserve the controlling input shape and receive fresh handle values: source shape controls when the parent is scalar or both inputs are nonscalar; otherwise parent shape controls. Copying the same object more than once to the same parent in one call rejects before mutation.

Because RunMat currently encodes graphics handles numerically, compatibility mode can separately enable exact host typed-integer handle aliases for all eight integer classes. Negative and nonexact values reject before lookup; exactly representable aligned wide integers proceed to ordinary handle lookup. Resident integer arrays always reject without provider gather.

RunMat validates the whole source/parent copy plan before mutating graphics state, so invalid handle arrays do not leave partial copies behind.

Copied plot children preserve their plotted geometry and readable/writable plot-child properties such as Type, Parent, data vectors, line styling, and display names.

Figure, axes, text, legend, ruler, root-object, UI-container, and composite-chart deep copies are rejected with RunMat:copyobj:InvalidArgument rather than silently returning shallow placeholders.

The optional copyobj(obj, parent, 'legacy') callback/application-data form is not implemented. Callback, application-data, context-menu, toolbar, axes-interaction, and data-tip-template copy rules remain general object-copy gaps.

Placement and residency

copyobj clones host-managed graphics state and does not execute numeric GPU kernels.

copyobj returns host-side numeric graphics handles. It does not gather, transform, or upload GPU arrays.

copyobj performs no provider dispatch because graphics object copying is a host graphics-registry operation.

When copied plot elements were originally built from GPU-resident input data, the existing plot-state representation is cloned; no additional CPU/GPU transfer is initiated by copyobj itself.

Execution, authority, and current limits

The canonical binding uses the same runtime implementation in interpreter and compiled execution. Requested output arity is checked before this operation can mutate graphics state or gather coordinate data; discarding an output does not suppress the operation.

Graphics handles encode local registry identities, not transferable figure, axes, or chart state. Copying a numeric handle to a worker, foreign runtime, or serialized value does not transfer its graphics authority. This host operation is a fusion boundary; no numeric GPU kernel or distributed implementation is supplied.

Finite Managed allocation remains an L25 obligation: complete scratch, metadata, retained graphics-state, and output ownership are not yet quoted by these implementations. The shared graphics admission owner refuses Managed policy before unowned work, captures cancellation authority, and checks it before publication; that safety fence is not finite-allocation completion. Unbounded host scratch may still contain synchronous loops.

Only supported plot children can be copied to axes. Plan validation precedes copying, but resource failure or external authority rotation during a multi-copy is terminal and is not a transaction rollback of already committed copies. Retained callback metadata is copied through its existing owner; this operation does not invoke user callback code.

Examples

Copy a line to another axes

h = plot(1:3, [1 4 9], 'DisplayName', 'source');
ax2 = subplot(1,2,2);
h2 = copyobj(h, ax2);
get(h2, 'Parent') == ax2

Copy a handle array to the same parent

h(1) = plot(1:3);
hold on;
h(2) = plot(3:-1:1);
ax2 = subplot(1,2,2);
h2 = copyobj(h, ax2);
size(h2)

Copy one object into two parent axes

h = plot(1:3);
ax1 = subplot(1,2,1);
ax2 = subplot(1,2,2);
h2 = copyobj(h, [ax1 ax2]);
size(h2)

Using copyobj with coding agents

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

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

FAQ

Does copyobj copy figures or axes?⌄

Not yet. This implementation covers plot-child graphics objects and reports a deterministic invalid-argument error for figure, axes, text, legend, ruler, and root deep-copy requests.

Does copying share mutable plot properties with the source?⌄

No. The copied plot receives a fresh handle and independent plot state.

Does copyobj launch GPU kernels?⌄

No. It operates on host-side graphics metadata. Plot geometry already stored in graphics state is cloned without provider dispatch.

Related Plotting functions

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 · gcf · get · set

Other

addpoints · ancestor · animatedline · autumn · axes · barh · bone · caxis · cla · clf · clim · colorcube · colororder · cool · copper · cylinder · daspect · datacursormode · dataTipTextRow · drawnow · fcontour · figure · fill · fill3 · findobj · fsurf · gobjects · gray · groot · hgload · hgsave · hidden · histogram2 · hold · hot · inferno · isgraphics · ishandle · jet · line · lines · linkaxes · magma · openfig · opengl · pan · parula · patch · pink · plasma · plotmatrix · plotyy · polarhistogram · polarplot · polarscatter · print · quiver3 · ribbon · saveas · savefig · sphere · spring · stackedplot · subtitle · summer · suptitle · text · textscatter · textscatter3 · triplot · turbo · viridis · waitbar · winter · wordcloud · xlabel · xlim · xline · xscale · xtickangle · xtickformat · xticklabels · xticks · ylabel · ylim · yline · yscale · ytickangle · ytickformat · yticklabels · yticks · zlim · zoom

Source you can read

Every RunMat function's source is public. Read exactly how copyobj is executed, line by line, in Rust.

  • View the source for copyobj in Rust on GitHub
  • Learn how the RunMat runtime works
  • Found a bug? Open an issue with a minimal reproduction.

About RunMat

RunMat is a runtime that executes MATLAB-syntax code fast on any GPU. The runtime is free for individuals, including freelancers; students and faculty at an academic institution, for teaching or research there; contributors to an open-source project, for work on that project; organizations with 250 or fewer people and US$10M or less in annual revenue; and anyone, for non-production use. See runmat.com/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.

Download RunMatOpen Sandbox
On this page
  • Syntax
  • Inputs
  • Returns
  • Errors
  • Behavior
  • Placement and residency
  • Execution, authority, and current limits
  • Examples
  • Copy a line to another axes
  • Copy a handle array to the same parent
  • Copy one object into two parent axes
  • Using copyobj with coding agents
  • FAQ
  • Related Plotting functions
  • 2D Charts
  • 3D & Surface
  • Images
  • Axes & Layout
  • Appearance
  • Handle Access
  • Other
  • Source you can read
  • About RunMat