Using the C Math Library    

MATLAB Structures

A MATLAB structure can be thought of as a one-dimensional cell array in which each cell is assigned a name. These named cells are called fields. You can create multidimensional arrays of structures but all the structures in the array must have the same fields.

This table lists the MATLAB C Math Library routines used to create structures and perform basic operations on them. The sections that follow provide more detail about using these routines. For more detailed information about using structures, see Using MATLAB. For more detailed information about any of the library routines, see the online MATLAB C Math Library Reference.

Table 3-5: MATLAB Structure Routines 
To ...
Use ...
Create a structure an initialize it with values.
mlfStruct()
Convert a cell array into a structure.
mlfCell2struct()
Determine the names of the fields in a structure.
mlfFieldnames()
Determine if a string is the name of a field in a structure.
mlfIsfield()
Access the contents of a field in a structure.
mlfGetfield()
Specify the value of a field in a structure.
mlfSetfield()
Remove a field from each structure in an array of structures.
mlfRmfield()


 Displaying the Contents of a Cell Array Creating Structures