Access Data in a Structure Array
This example shows how to access the contents of a structure array. To run the code in
this example, load several variables into a scalar (1-by-1) structure named S.
S = load('clown.mat')
S = struct with fields:
X: [200x320 double]
map: [81x3 double]
caption: [2x1 char]
The variables from the file (X, caption, and map) are now fields in the struct.
Access the data using dot notation of the form structName.fieldName. For example,
pass the numeric data in field X to the image function:
image(S.X)
colormap(S.map)
Access Data in a Structure Array