To convert a structure to a cell array in MATLAB, you can use the struct2cell
function. Here's an example:
main.m193 chars8 lines
The resulting variable myCell
will be a 3-by-1 cell array, with each cell containing one of the fields from the original structure. You can access each cell using standard cell array indexing:
main.m71 chars3 lines
Note that the order of the cells in the resulting cell array will be determined by the order of the fields in the original structure.
gistlibby LogSnag