필터 지우기
필터 지우기

How to find from what row an outprint comes from

조회 수: 30 (최근 30일)
Fredrik
Fredrik 2011년 11월 11일
Hi Everyone. For some reason i get a very large "data print" in the command window when i import data with my import file. For what I can see, I have put ; in the end of every row which I thought would terminate all kinds of outputs.
Now I wonder if there is any command that can look from which row in my m file this data print comes from? Thank you! Fredrik Lindelöw

채택된 답변

Fangjun Jiang
Fangjun Jiang 2011년 11월 11일
The "data print" might be generated by fprintf() though.
Anyway, you can turn on echo and then run the code. It will interlace your code and the output. Then you can find it out.
echo on;
  댓글 수: 2
Jan
Jan 2011년 11월 11일
+1: After all these years I learn a situation when ECHO is useful. Thanks.
Fangjun Jiang
Fangjun Jiang 2011년 11월 11일
For this question, I though about echo() right away. But in this similar previous question, it took me a while to thought about it.
http://www.mathworks.com/matlabcentral/answers/17651-why-do-i-get-ans-1-in-the-command-window

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

추가 답변 (3개)

Jan
Jan 2011년 11월 11일
You can use the debugger also: Set a breakpoint in the code and step through the program line by line until the output appears.
There might be a disp or display, an unterminated line in a subfunction, or a comma after a command e.g. when twi commands are written to a single line.

Walter Roberson
Walter Roberson 2011년 11월 11일
dbstop in disp
dbstop in fprintf
and possibly even
dbstop in display

Fredrik
Fredrik 2011년 11월 11일
Thank you very much, never thought this woulf be such an interesting quiestion! I will try your advice as soon as possible!

카테고리

Help CenterFile Exchange에서 Debugging and Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by