Using the C++ Math Library | ![]() ![]() |
Assigning Values to a Structure Field
To assign an initial value to a field (creating the field if it doesn't exist) or to modify the value of an existing field, use structure array indexing on the left-hand side of the assignment operator. For example, to change the description field of the seventeenth image, you'd write this code:
images(17).field("description") = "Ferris Wheel"
;
images(17).description = 'Ferris Wheel'
performs the same operation in MATLAB.
![]() | Accessing the Contents of a Structure Field | Assigning Values to Elements in a Field | ![]() |