In MATLAB, you can index into a cell array to access its elements. To access the first element (or any element) of a cell array, you use curly brackets {}
instead of parentheses ()
as you would in regular numeric indexing.
Here's an example:
main.m147 chars6 lines
In this example, myCellArray{1}
will return the value 'apple'
, which is the first element of the cell array. Note that indexing with {}
returns the contents of the specified cell, rather than a sub-array.
gistlibby LogSnag