I am relatively new to matlab, and I was wondering if there was a simpler way to do the following:
Given mycellarray = {[1 2 3 4] [5 6 7 8] [9 10 11 12] [13 14 15 16]}
, I would like to assign each matrix inside mycellarray
to a separate variable. Is there any faster/better/shorter way to do it than this?
a = cell2mat(mycellarray(1,1))
b = cell2mat(mycellarray(1,2))
c = cell2mat(mycellarray(1,3))
d = cell2mat(mycellarray(1,4))
Thanks in advance!
[a,b,c,d]=mycellarray{:}
The {:}
makes a comma seperated list of the cell array, which an be assigned to individual variables.
relevant documentation pages: