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

isfield — Test whether structure metadata contains one or more field names.

isfield returns scalar or same-shaped logical results for exact, case-sensitive field-name queries without reading stored values.

Syntax

tf = isfield(S, name)

Inputs

S
Type
Any
Required
Yes
Description
Value whose structure metadata is queried.
name
Type
Any
Required
Yes
Description
Character row, string value, string array, or cell collection of names.
NameTypeRequiredDefaultDescription
SAnyYes—Value whose structure metadata is queried.
nameAnyYes—Character row, string value, string array, or cell collection of names.

Returns

tf
Type
LogicalArray
Description
Logical result matching the field-name query shape.
NameTypeDescription
tfLogicalArrayLogical result matching the field-name query shape.

Errors

RunMat:isfield:TooManyOutputs
When
More than one output is requested.
Message
isfield: too many output arguments
RunMat:isfield:FieldNameType
When
Field-name input is not a string scalar, string array, character row, or cell collection of scalar text.
Message
isfield: field names must be strings, string arrays, or cell arrays of character vectors
RunMat:isfield:CellElementType
When
A field-name cell element is not scalar string or character-row text.
Message
isfield: cell array elements must be character vectors or strings
RunMat:isfield:InternalError
When
Logical result construction fails.
Message
isfield: internal error
IdentifierWhenMessage
RunMat:isfield:TooManyOutputsMore than one output is requested.isfield: too many output arguments
RunMat:isfield:FieldNameTypeField-name input is not a string scalar, string array, character row, or cell collection of scalar text.isfield: field names must be strings, string arrays, or cell arrays of character vectors
RunMat:isfield:CellElementTypeA field-name cell element is not scalar string or character-row text.isfield: cell array elements must be character vectors or strings
RunMat:isfield:InternalErrorLogical result construction fails.isfield: internal error

Queries and results

isfield(S,name) compares field names exactly and case-sensitively. A character row or scalar string produces one logical scalar. A string array or cell collection of scalar text produces a logical array with the query collection's shape.

If S is not a structure, the result is false with the same scalar or array form. Unsupported field-name values reject instead of converting numbers or other values to text.

Structure arrays

A structure array has one ordered field schema shared by every element, so a queried name is either present for the complete array or absent. Empty structure arrays retain this schema.

Ordinary cell arrays remain non-structure inputs even when every cell happens to contain a scalar structure.

Residency and execution

isfield reads outer host-side metadata only. It does not inspect, copy, or gather values stored in a structure, launches no accelerator kernel, and forms a fusion boundary.

Examples

Test one field name

s = struct('name', 'entry', 'score', 42);
hasScore = isfield(s, 'score')

Expected output:

hasScore = true

Test a shaped cell of names

s = struct('name', 'entry', 'score', 42);
names = {'name', 'department'; 'score', 'email'};
mask = isfield(s, names)

Expected output:

mask = logical [1 0; 1 0]

Query a structure array

entries = struct('name', {'first', 'second'}, 'id', {101, 102});
mask = isfield(entries, ["id", "department"])

Expected output:

mask = logical [1 0]

Initialize an optional field

cfg = struct('mode', 'fast');
if ~isfield(cfg, 'rate')
    cfg.rate = 60;
end

Expected output:

cfg.rate = 60

Mix string and character names

opts = struct('Solver', 'cg', 'MaxIter', 200);
queries = {"Solver", 'Tolerances'; 'MaxIter', "History"};
present = isfield(opts, queries)

Expected output:

present = logical [1 0; 1 0]

Query a non-structure value

value = 42;
tf = isfield(value, 'anything')

Expected output:

tf = false

Using isfield with coding agents

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

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

FAQ

Which field-name inputs are accepted?⌄

Character rows, scalar strings, string arrays, and cell arrays whose elements are character rows or scalar strings.

What happens when the first input is not a structure?⌄

The result is false, or a same-shaped logical array of false values. Use isstruct when the value's class must be checked separately.

How are structure arrays queried?⌄

The query is checked against the array's shared field schema.

What happens for an empty structure array?⌄

The query is checked against the field schema retained by the empty array.

Are comparisons case-sensitive?⌄

Yes. Names must match exactly, including case.

Does isfield gather GPU data?⌄

No. Nested resident values remain with their provider because only outer metadata is read.

Related Structs functions

fieldnames · getfield · orderfields · rmfield · setfield · struct · structfun

Source you can read

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

  • View the source for isfield 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
  • Queries and results
  • Structure arrays
  • Residency and execution
  • Examples
  • Test one field name
  • Test a shaped cell of names
  • Query a structure array
  • Initialize an optional field
  • Mix string and character names
  • Query a non-structure value
  • Using isfield with coding agents
  • FAQ
  • Related Structs functions
  • Source you can read
  • About RunMat