MATLAB Function Reference
  Go to function:
    Search    Help Desk 
struct    Examples   See Also

Create structure array

Syntax

Description

s = struct('field1',values1,'field2',values2,...) creates a structure array with the specified fields and values. The value arrays values1, values2, etc. must be cell arrays of the same size or scalar cells. Corresponding elements of the value arrays are placed into corresponding structure array elements. The size of the resulting structure is the same size as the value cell arrays or 1-by-1 if none of the values is a cell.

Examples

The command

produces a structure array s:

The value arrays have been distributed among the fields of s:

See Also

fieldnames  Field names of a structure

getfield    Get field of structure array

rmfield     Remove structure fields

setfield    Set field of structure array



[ Previous | Help Desk | Next ]