disp error: Dimensions of matrices being concatenated are not consistent.
2 次查看(过去 30 天)
显示 更早的评论
Q_output =
1.0e+03 *
0.0181 0.0011 0.0125
1.1500 0.4000 0.2000
0.0119 -0.0011 0.0175
-0.4000 -0.2000 -0.8000
M=1:3;
I want to display the two matrices above in a table so M is a column before Q_output. I tried disp([M',Q_output]), but I get the following error message
"Error using horzcat
Dimensions of matrices being concatenated are not consistent."
How do I fix it?
Q_output =
1.0e+03 *
0.0181 0.0011 0.0125
1.1500 0.4000 0.2000
0.0119 -0.0011 0.0175
-0.4000 -0.2000 -0.8000
M=1:3;
I want to display the two matrices above in a table so M is a column before Q_output. I tried disp([M',Q_output]), but I get the following error message
"Error using horzcat
Dimensions of matrices being concatenated are not consistent."
How do I fix it?
0 个评论
回答(1 个)
Star Strider
2017-4-8
You can’t.
You can have ‘M’ as a row above ‘Q_output’, but since the lengths of ‘M’ and the row length of ‘Q_output’ are not equal, you cannot concatenate them horizontally.
This is the best you can do:
Result = [M; Q_output]
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!