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 mlfIndexRef()
to combine all the operations into a single call. Assume the cell array c contains a three-element structure array of images.
You can combine cell array and standard indexing to access a single field of a single structure:
mlfAssign(&second_date, mlfIndexRef(c, "{?}(mlfScalar(2)).date", mlfScalar(1)));
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 | ![]() |