how to stop variable auto display in command window

조회 수: 15 (최근 30일)
pierre
pierre 2012년 2월 15일
댓글: Jack Giunta 2019년 10월 15일
Hi everybody,
everytime I create a variable (ie a = zeros(n,n,n)) and do operation on the matrix created like a :
for i=1:n
a(i,0,0) = log(tmp(i) / tmp(i-1);
end
the matrix is being displayed in the command window (in the for loop, matrix being displayed n times). I would like to stop that but I cannot find how. I would like the command window to display only the variables I am asking it to display via the disp function.
Anyone ?
PS : if there any shortcut that perfom the for loop ?
  댓글 수: 1
Jack Giunta
Jack Giunta 2019년 10월 15일
Add a semicolon to the end of the lines that update variables. This will tell the command window to skip displaying these variable changes. Super helpful for debugging in iteration since you can choose which variables display updates line by line!

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

답변 (2개)

Andreas Goser
Andreas Goser 2012년 2월 15일
As your example code does not run at all (brackets unbalanced, zero indices), I am not sure if your real code uses the semicolon. The semicolon supresses the output.

pierre
pierre 2012년 2월 15일
sorry I improvised it to simplify it (code much more complex), good code looks like
for i=1:n
a(i,1,1) = log(tmp(i) / tmp(i-1));
end
The idea is that every change in a cell of 'a' implies a full display of the 'a' matrix in the command window which I don't want.
  댓글 수: 1
Jan
Jan 2012년 2월 15일
Nothing is displayed in the command window, if you run the posted code.

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

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by