Horzcat error with num2str in disp function.
조회 수: 12 (최근 30일)
이전 댓글 표시
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
답변 (2개)
dpb
2015년 2월 10일
Because A is 3x3 whereas the string is 1xlength(). Use
disp(['The values in A are' num2str(A(:).') '.'])
댓글 수: 0
Star Strider
2015년 2월 10일
Another option:
A = [5,6,7;8,9,10;11,12,13];
disp('The values in A are ')
disp(A)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Argument Definitions에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!