Cell2mat input cell array error

조회 수: 12 (최근 30일)
Diana
Diana 2013년 8월 12일
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
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.
Diana
Diana 2013년 8월 13일
thank you! It helped me a lot!

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
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
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 CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by