Cell2mat input cell array error
12 次查看(过去 30 天)
显示 更早的评论
I have this error:
Error using cell2mat (line 46) All contents of the input cell array must be of the same data type.
When I check input cell array, it is all numbers or empty cells. I replaced it for only one column with only numbers and still same problem. Does anyone have any idea of what it could be?
Thanks
4 个评论
Iman Ansari
2013-8-12
A={[1 2],uint8([3 4])};
cell2mat(A)
Error using cell2mat (line 46)
All contents of the input cell array must be of the same data type.
采纳的回答
Image Analyst
2013-8-12
Are you sure that all cells could be extracted to form a solid 2D matrix with no "missing" elements? You can't ask it to have one row with 10 elements and the row below it to have 7 elements. Those empty cells could be causing your problem.
1 个评论
Image Analyst
2013-8-12
Make [1 2] uint8 also. Or else make [3 4] double. If you're using integers, they must match exactly with other integers of the same class (uint8 or uint16 or int32).
更多回答(0 个)
另请参阅
类别
在 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!