How do a pause execution within a file when a specific line produces a warning?
15 次查看(过去 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.
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!