disp error: Dimensions of matrices being concatenated are not consistent.

2 visualizaciones (últimos 30 días)
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?

Respuestas (1)

Star Strider
Star Strider el 8 de Abr. de 2017
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]

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by