필터 지우기
필터 지우기

Error using cat AND cell2mat

조회 수: 5 (최근 30일)
vandana sharma
vandana sharma 2019년 1월 24일
답변: Guillaume 2019년 1월 24일
I am getting following error, please help.
...............................
Error using cat
Dimensions of matrices being concatenated are not consistent.
Error in cell2mat (line 83)
m{n} = cat(1,c{:,n});
......................................
  댓글 수: 1
madhan ravi
madhan ravi 2019년 1월 24일
upload c as .mat file

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

채택된 답변

Guillaume
Guillaume 2019년 1월 24일
The error is clear. For cell2mat to concatenate the matrices in the cell array into one matrix, the matrices must have consistent size. Yours haven't. There's nothing we can do about it. Use consistent matrix sizes. if they were supposed to be consistent then go back through your code to find out why they're not.
Example of valid cell array:
c = {zeros(4,4), ones(4,1); ... the height of the matrices in each row is the same
ones(2,4), zeros(2,1)}
%the width of the matrices in each column is the same
Example of a cell array that can't be converted with cell2mat:
c = {zeros(4 4), ones(3, 1); ... inconsistent height of matrices in the row
ones(2, 3), zeros(2, 1)}
%inconsistent width of matrices in first column

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Cell Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by