Using the C++ Math Library | ![]() ![]() |
Accessing the Contents of Structures Within Cells
Cell arrays can contain structure arrays and vice-versa. Accessing a structure stored in a cell array is very similar to accessing a structure stored in a regular variable; you just need to extract it from the cell array first. You use mwArray::cell()
to extract the cell array.
Assume the cell array c contains a three-element structure array of images.
You can also combine cell array and standard indexing to access a single field of a single structure:
second_date = c.cell(1)(2).field("date")
;
second_date = c{1}(2).date
performs the same operation in MATLAB. In this case, the result is a single date structure.
![]() | Referencing into Nested Structures | Deleting Elements from a Structure Array | ![]() |