Using the C++ Math Library | ![]() ![]() |
Assigning Values to Elements in a Field
You can also modify array data contained in a structure field. You must pass the field name to mwArray::field()
and the type of indexing to perform on the contained array. For example, this code replaces a 3-by-3 subarray of the image data of the ninth image, with the data in the 3-by-3 array x
. You might do this as part of some image processing operation.
images(9).field("image")(colon(1,3),colon(2,4)) = x
;
images(9).image(1:3,2:4) = x
performs the same operation in MATLAB.
![]() | Assigning Values to a Structure Field | Referencing a Single Structure in a Structure Array | ![]() |