struct
Create a structure with named fields.
Syntax
Section titled “Syntax”s = structs = struct(field1, value1, field2, value2, ...)Description
Section titled “Description”Builds a structure with the given field/value pairs. Field names are strings; values are arbitrary. With cell-array values of the same size, builds a struct array (one element per cell-array entry).
Examples
Section titled “Examples”s = struct('name', 'Alice', 'age', 30);s.name % 'Alice's = struct('x', {1, 2, 3}); % 1×3 struct arraySee also
Section titled “See also”fieldnames— List of field names in a structure.isstruct— Test whether the input is a structure.rmfield— Remove fields from a structure.setfield— Set the value of a structure field by name.getfield— Get the value of a structure field by name.