Horzcat error with num2str in disp function.
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
When I run the following script:
A = [5,6,7;8,9,10;11,12,13];
disp(['The values in A are' num2str(A) '.'])
I get the following error message:
Error using horzcat
Dimensions of matrices being concatenated are not consistent.
Why?
0 Kommentare
Antworten (2)
dpb
am 10 Feb. 2015
Because A is 3x3 whereas the string is 1xlength(). Use
disp(['The values in A are' num2str(A(:).') '.'])
0 Kommentare
Star Strider
am 10 Feb. 2015
Another option:
A = [5,6,7;8,9,10;11,12,13];
disp('The values in A are ')
disp(A)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Argument Definitions finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!