Display the error containing line in .m file
4 ビュー (過去 30 日間)
古いコメントを表示
Is there a method to display the error containing line in .m file, when the execution stops?
1 件のコメント
Oleg Komarov
2011 年 8 月 2 日
Your question sounds like:
How to pinpoint the line that errors in a "highlight some lines + F9"?
回答 (3 件)
Jan
2011 年 8 月 2 日
Perhaps you are looking for:
dbstop if error
or if you want to catch error inside TRY-CATCH also:
dbstop if all error
[EDITED]: In modern Matlab versions this is documented:
dbstop if caught error
Then the failing line is highlighted in the editor automatically.
8 件のコメント
Fangjun Jiang
2011 年 8 月 2 日
It is usually indicated in the error message.
Also, help dbstack.
5 件のコメント
Jan
2011 年 8 月 3 日
Under which circumstances does it (MATLAB?) show "error at" without a line number? Usually a line number is following.
Paulo Silva
2011 年 8 月 2 日
After you get the error, execute this
l=lasterror;
fprintf('The last error was on line %d of the file called %s \n',...
l.stack.line,l.stack.name)
1 件のコメント
参考
カテゴリ
Help Center および File Exchange で Debugging and Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!