Text-only
Table of Contents (
frame
/
no frame
)
(8) Matlab Structures
Structures
Structures are multidimensional arrays
Elements are accessed by named fields
Fields can contain any type of data
Syntax is similar to C
Storage is allocated dynamically
Syntax:
>> struct_name(record #).field_name=data
Try:
students.name = 'Sally';
students.grades= [97 93 ];
students(2).name = 'John';
students(2).grades= [94 96 ];
or
students= struct('name',{'Sally','John'},'grades',{[97 93], [94 96]});
students(1).name
students.grades
Structures.src last modified Oct 17, 2007
Introduction
Table of Contents
(
frame
/
no frame
)
Printable
(single file)
© Dartmouth College