フィルターのクリア

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

1 回表示 (過去 30 日間)
Waseem Hussain
Waseem Hussain 2017 年 11 月 12 日
コメント済み: Roger Stafford 2017 年 11 月 12 日
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 Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by