cell2mat error
4 次查看(过去 30 天)
显示 更早的评论
"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 个评论
回答(3 个)
Fangjun Jiang
2011-8-15
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 个评论
Danielle Leblanc
2011-8-15
1 个评论
Fangjun Jiang
2011-8-15
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)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!