cell2mat error
3 views (last 30 days)
Show older comments
"a" is a 5000x12 cell matrix. all value in "a" are numeric. I tried to convert from cell to double using cell2mat(a) and i received the following error: ??? Error using ==> cat CAT arguments dimensions are not consistent.
Error in ==> cell2mat at 89 m{n} = cat(1,c{:,n});
how can I convert this matrix to double?
0 Comments
Answers (3)
Fangjun Jiang
on 15 Aug 2011
Probably the numeric elements of the cell array are not the same size. See example:
a={1 2;3 4}
b=cell2mat(a)
c={1 2;[3 4] 5}
d=cell2mat(c)
0 Comments
Danielle Leblanc
on 15 Aug 2011
1 Comment
Fangjun Jiang
on 15 Aug 2011
Is every element supposed to be scalar? Use the following to check the size of each element.
c={1 2;[3 4] 5};
d=cellfun(@size,c,'uni',0);
e=cell2mat(d);
f=all(e==1)
See Also
Categories
Find more on Data Type Conversion in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!