필터 지우기
필터 지우기

Error using vertcat - dimensions of matrices being concatenated are not consistent

조회 수: 1 (최근 30일)
Hi,
I keep getting this error, Error using vertcat - dimensions of matrices being concatenated are not consistent This is my code
W = [ones(1,56);1.41*ones(1,37);0.71*ones(1,16)];

답변 (2개)

Roger Stafford
Roger Stafford 2017년 11월 12일
In W you are asking that it have three rows, the first one with 56 elements, the second with only 37, and the third with 16. That is contrary to the requirement that all rows in a matrix have the same number of elements.

Waseem Hussain
Waseem Hussain 2017년 11월 12일
Oh, what I actually wanted to do is have one row of all these values, how would I do that?
  댓글 수: 1
Roger Stafford
Roger Stafford 2017년 11월 12일
Change to:
W = [ones(1,56),1.41*ones(1,37),0.71*ones(1,16)];
That is, change the two semicolons to commas.

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by