How can I visualize a Matrix Data in Workspace in common Matrix notation, instead of with semicolon notation?
조회 수: 1 (최근 30일)
이전 댓글 표시
I'm dealing with huge sets of matrices and I want to print them.
However in Workspace data is shown as:
[x x x; x x x; x x x]
I want it to be shown as:
[x x x]
[x x x]
[x x x]
Is there a way to do that? Thank you.
댓글 수: 0
답변 (1개)
BhaTTa
2024년 8월 30일
@Bidsitlov, to print or display the workspace variable(in your case the variable is a 3x3 matrix) in the format mentioned by you, refer to the code given below:
% Example Matrix
A = [1 2 3; 4 5 6; 7 8 9];
[m, n] = size(A);
% Print the matrix row by row
fprintf('Matrix A:\n');
for i = 1:m
fprintf('[%g %g %g]\n', A(i, :));
end
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Whos에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!