FUNCTION REFERENCE

struct

Create a structure with named fields.

Create a structure with named fields.

Syntax

struct()

Syntax

struct(field, value, ...)

With no arguments, creates a scalar struct with no fields. Field names must be unique ASCII identifiers of at most 63 characters; up to 1024 fields are allowed. Non-cell values repeat across the struct array; nonscalar cell values set its shape and distribute their contents by element. All nonscalar cell shapes must match. A scalar cell contributes its content to every element; use a nested cell to keep a cell as a field value. Dot access and dynamic access such as S.(name) are supported.

Example

s=struct('a',{1,2,3}); s(2).a   % 2

Differences from MATLAB: Some struct display spacing differs. Only 2-D structs are supported (s(i,j,k) assignment reports that N-D struct arrays are not supported yet); containers are limited to 65536 slots and 16 nesting levels. Object conversion forms are not supported.

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