Let's say, that i have a cell array of cells containing only numeric values. Its name is Q.
Q = { {[0] [1] [0] [238]} }
Q{1}
ans =
[0] [1] [0] [238]
What i would like to do, is to combine all these 4 cells into just one. In that case, it would be something like the one below:
Q{1}
ans =
0 1 0 238
Any help would be really appreciated.
You have a double-nested cell array:
and you need comma-separated lists to transform it into an array. I assume you have multiple cell arrays within
Q
, so you can usecellfun
:and you get
For one element this is equivalent to:
as the
x
in thecellfun
operation is equivalent toQ{i}
wherei
is the running variable.But if you you just have this one array in your cell array, consider:
as you don't need it to be a cell array at all.