FUNCTION REFERENCE

getfield

Read a field from a scalar struct.

Read a field from a scalar struct.

Syntax

getfield(S, field)

Syntax

getfield(S, field1, field2, ...)

Follows the given character field names through nested scalar structs and returns the final value. Missing fields raise an error.

Example

s=struct('a',1,'b','x'); getfield(s,'b')   % 'x'

Differences from MATLAB: Cell index arguments and nonscalar structs are not supported.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.