Programming and Data Types    

Structures and Cell Arrays


Structures are collections of different kinds of data organized by named fields. Cell arrays are a special class of MATLAB array whose elements consist of cells that themselves contain MATLAB arrays. Both structures and cell arrays provide a hierarchical storage mechanism for dissimilar kinds of data. They differ from each other primarily in the way they organize data. You access data in structures using named fields, while in cell arrays, data is accessed through matrix indexing operations.

This table describes the MATLAB functions for working with structures and cell arrays.

Category
Function
Description
Structure functions
fieldnames
Get structure field names.
getfield
Get structure field contents.
isfield
True if field is in structure array.
isstruct
True for structures.
rmfield
Remove structure field.
setfield
Set structure field contents.
struct
Create or convert to structure array.
struct2cell
Convert structure array into cell array.
Cell array functions
cell
Create cell array.
cell2struct
Convert cell array into structure array.
celldisp
Display cell array contents.
cellfun
Apply a cell function to a cell array.
cellplot
Display graphical depiction of cell array.
deal
Deal inputs to outputs.
iscell
True for cell array.
num2cell
Convert numeric array into cell array.
.


 Applying Functions to Multidimensional Structure Arrays Structures