How to find the execute but don't display output syntax of a loop?

조회 수: 15 (최근 30일)
Lina Baquero
Lina Baquero 2012년 11월 28일
Hi, i have this problem: Let A_ij =ij-j^2 for all i,j {1.2...10}
Im using this for loop:
for i=1:10
for j=1:10
A(i,j)=i*j-j^2
end
end
However I need to find a way to do the for loop without displaying the result each step. In other words, find the execute but don't display output syntax.
I don't know how to do it.
  댓글 수: 2
per isakson
per isakson 2012년 11월 28일
편집: per isakson 2012년 11월 28일
A trailing ";" suppresses output.
Jan
Jan 2012년 11월 28일
Such basic details are explained in the Getting Started chapters of the doucmentation. You cannot use such a powerful tool as Matlab without reading the documentation.

댓글을 달려면 로그인하십시오.

답변 (2개)

Sabarinathan Vadivelu
Sabarinathan Vadivelu 2012년 11월 28일
for i=1:10
for j=1:10
A(i,j)=i*j-j^2;
end
end
Use semicolon at the end of the statements to suppress the output

Vishal Rane
Vishal Rane 2012년 11월 28일
Use ';' at the end of a statement. It suppresses the display of output on the command window.
In your case
A(i,j)=i*j-j^2;
Refer Link for more information.

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by