Code in script is printing to command window
古いコメントを表示
I am editing a program that someone else wrote, and when I run it, each time it prints a number to the command window. I would like to find what line of code is causing this, but I can not find it and the script is many pages long. I have tried scanning to see if any line is missing the semi colon supresion and have also used find to search for "disp(", but I did not find anything.
採用された回答
その他の回答 (1 件)
Daniel Shub
2012 年 8 月 9 日
編集済み: Daniel Shub
2012 年 8 月 9 日
I can think of three ways of doing this.
- Set break points to narrow down where the output occurs. This could involve a lot of trial and error and if the code takes a long time to run will be inefficient.
- Overload disp and fprintf to be something like dbstack. Assuming the output is invoked by either of these two methods you will get the calling line number.
- Use ECHO. The output will show you each line of code and what it produces.
I do not believe anyone starts their code with
clear all; close all; echo off;
anymore, so you should be pretty safe.
By the way I am wanting upvotes for finding a potentially useful way of reviving a long dead command
カテゴリ
ヘルプ センター および File Exchange で Construct and Work with Object Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!