To convert a struct
into a cell
, you can use the struct2cell
function provided by MATLAB.
Here is an example:
main.m159 chars8 lines
The resulting myCell
variable will be a cell
array with the values of the fields of the struct
.
You can then access these values using indexing. For example:
main.m50 chars3 lines
Keep in mind that the order of the cells in the resulting myCell
array will be the same as the order of the fields in the original struct
.
gistlibby LogSnag