metaclass — Return metadata for the runtime class of a value.

metaclass(object) returns RunMat's metadata reference for the runtime class of object. RunMat represents MATLAB matlab.metadata.Class values as ClassRef metadata tokens, the same representation produced by the ?ClassName parser path.

Syntax

mc = metaclass(object)

Inputs

NameTypeRequiredDefaultDescription
objectAnyYesObject or value whose runtime class metadata is requested.

Returns

NameTypeDescription
mcAnyMeta-class reference for the input value's runtime class.

How metaclass works

  • Object and handle-object inputs return a metadata reference for their registered runtime class.
  • Text inputs describe the runtime text class. A row character vector returns metadata for char; a string scalar or string array returns metadata for string.
  • Class references are ordinary metadata objects to metaclass and return metadata for meta.class.
  • gpuArray inputs return metadata for gpuArray without gathering provider buffers.
  • Numeric, logical, cell, struct, function-handle, listener, and MException values return metadata for their RunMat runtime class.
  • RunMat does not yet materialize full MATLAB matlab.metadata.Class object properties such as PropertyList, MethodList, or SuperclassList; those remain part of the broader metadata-object work.

Examples

Get metadata for an object

obj = Point();
mc = metaclass(obj)

Expected output:

mc = <class Point>

Text inputs describe text classes

mc = metaclass('Point')

Expected output:

mc = <class char>

Use the question-mark operator for class-name metadata

mc = ?Point

Expected output:

mc = <class Point>

Using metaclass with coding agents

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

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

FAQ

Does metaclass("Point") look up the Point class?

No. This follows MATLAB semantics: text passed to metaclass is a text value, so RunMat returns metadata for string or char. Use ?Point or classref("Point") for class-name metadata.

Is the result a full MATLAB metadata object?

Not yet. RunMat returns its existing ClassRef metadata token. Static member and method dispatch already use this token, but full metadata property enumeration is still tracked by the object/type-introspection umbrella.

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how metaclass 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.