How do a pause execution within a file when a specific line produces a warning?
14 ビュー (過去 30 日間)
古いコメントを表示
Say I have a main file and a function file. I am getting a 'Matrix is singular, close to singular or badly scaled' warning and I would like to examine the inside of the function to find out what is causing this. So I want to pause the code on this error, view the variables within the function, and then investigate. How do I do this?
0 件のコメント
回答 (2 件)
Walter Roberson
2018 年 11 月 3 日
warning('error', 'MATLAB:singularMatrix')
dbstop if error
and run your code.
2 件のコメント
Steven Lord
2018 年 11 月 3 日
dbstop if warning
If you prefer to set this debugging condition via the UI, see the "Error Breakpoints" section of this documentation page.
0 件のコメント
参考
カテゴリ
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!