필터 지우기
필터 지우기

How to display large matrix

조회 수: 30 (최근 30일)
Akinyemi
Akinyemi 2023년 3월 31일
답변: Jack 2023년 3월 31일
I generate a 100 by 100 matrix I want to display the whole matrix on the screen By displaying the rows and columns in the form 1 2 3 .... 100

답변 (1개)

Jack
Jack 2023년 3월 31일
To display the entire 100 by 100 matrix on the screen with row and column indices in MATLAB, you can use the disp function to display the matrix and a nested loop to iterate through the rows and columns and print the corresponding indices at each iteration. Here's an example code snippet:
% generate a 100x100 matrix filled with zeros
matrix = zeros(100);
% display the matrix with row and column indices
for i = 1:size(matrix, 1)
for j = 1:size(matrix, 2)
% print the row and column indices followed by the value
fprintf('%d ', matrix(i,j));
end
fprintf('\n');
end

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by