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
    • fieldnames
    • getfield
    • isfield
    • orderfields
    • rmfield
    • setfield
    • struct
    • structfun

fieldnames — List structure fields and supported RunMat object properties.

fieldnames returns a column cell array of character-row names without reading or gathering stored values.

Syntax

names = fieldnames(S)

Inputs

S
Type
Any
Required
Yes
Description
Structure or supported RunMat object.
NameTypeRequiredDefaultDescription
SAnyYes—Structure or supported RunMat object.

Returns

names
Type
Any
Description
Column cell array of character-row names.
NameTypeDescription
namesAnyColumn cell array of character-row names.

Errors

RunMat:fieldnames:TooManyOutputs
When
More than one output is requested.
Message
fieldnames: too many output arguments
RunMat:fieldnames:InvalidTarget
When
Input is not a structure or supported RunMat object.
Message
fieldnames: expected struct, struct array, or supported object
RunMat:fieldnames:InternalError
When
Output construction or internal metadata processing fails.
Message
fieldnames: internal error
IdentifierWhenMessage
RunMat:fieldnames:TooManyOutputsMore than one output is requested.fieldnames: too many output arguments
RunMat:fieldnames:InvalidTargetInput is not a structure or supported RunMat object.fieldnames: expected struct, struct array, or supported object
RunMat:fieldnames:InternalErrorOutput construction or internal metadata processing fails.fieldnames: internal error

Structure field order

fieldnames(S) returns an N-by-1 cell array of character rows. A scalar structure retains insertion order and comparisons remain case-sensitive.

Structure arrays retain one ordered field schema across every element. Empty scalar structures return a 0-by-1 cell array; empty structure arrays retain and report their declared field schema.

Object-family extension

In RunMat compatibility mode, value objects, handle objects, and listeners expose the property metadata currently represented by the runtime. Class-declared nonstatic properties, inherited properties, dynamic instance properties, and valid handle-target metadata are merged into a deterministic result.

Object-family introspection is a RunMat extension rather than a claim of complete MATLAB object-property policy. MATLAB compatibility mode rejects these object inputs before inspecting them.

Residency and execution

fieldnames reads host-side metadata only. Values nested in a structure or object are not evaluated or gathered, so resident tensor handles remain owned by their provider. The operation launches no accelerator kernel and is a fusion boundary.

Examples

List scalar structure fields

s = struct('name', 'entry', 'score', 42);
fields = fieldnames(s)

Expected output:

fields = {'name'; 'score'}

Check fields before access

stats = struct('min', 1.2, 'max', 9.8);
fields = fieldnames(stats);
hasMedian = any(strcmp(fields, 'median'))

Expected output:

hasMedian = false

List structure-array fields

entries = struct('name', {'first', 'second'}, 'id', {101, 102});
fields = fieldnames(entries)

Expected output:

fields = {'name'; 'id'}

List fields in a nested structure

config.database = struct('host', 'db.local', 'port', 5432);
names = fieldnames(config.database)

Expected output:

names = {'host'; 'port'}

Handle empty structures

emptyScalar = struct();
emptyArray = struct('id', {});
fs = fieldnames(emptyScalar);
fa = fieldnames(emptyArray)

Expected output:

fs is 0-by-1; fa contains the declared field 'id'

Keep case-distinct names

s = struct('name', 1, 'Name', 2);
names = fieldnames(s)

Expected output:

names = {'name'; 'Name'}

Using fieldnames with coding agents

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

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

FAQ

What does fieldnames return?⌄

An N-by-1 cell array whose elements are character-row field names.

Are field names sorted?⌄

Scalar structures and structure arrays retain field insertion order. Supported object families use deterministic property ordering.

Can fieldnames inspect structure arrays?⌄

Yes. It returns the array's ordered field schema, including the retained schema of an empty structure array. Ordinary cell arrays remain cells even when their elements are structures.

Can fieldnames inspect objects?⌄

RunMat compatibility mode supports the currently represented value, handle, and listener properties as an explicit extension. MATLAB compatibility mode rejects that extension.

Does fieldnames gather GPU data?⌄

No. It inspects metadata and leaves nested provider-resident values untouched.

Are unsupported inputs converted?⌄

No. Numeric, logical, text, and resident array inputs reject without conversion.

Related Structs functions

getfield · isfield · orderfields · rmfield · setfield · struct · structfun

Source you can read

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

  • View the source for fieldnames 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
  • Structure field order
  • Object-family extension
  • Residency and execution
  • Examples
  • List scalar structure fields
  • Check fields before access
  • List structure-array fields
  • List fields in a nested structure
  • Handle empty structures
  • Keep case-distinct names
  • Using fieldnames with coding agents
  • FAQ
  • Related Structs functions
  • Source you can read
  • About RunMat