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)];
0 个评论
回答(2 个)
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.
0 个评论
Waseem Hussain
2017-11-12
1 个评论
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 Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!