Filter löschen
Filter löschen

How do a pause execution within a file when a specific line produces a warning?

20 Ansichten (letzte 30 Tage)
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?

Antworten (2)

Walter Roberson
Walter Roberson am 3 Nov. 2018
warning('error', 'MATLAB:singularMatrix')
dbstop if error
and run your code.

Steven Lord
Steven Lord am 3 Nov. 2018
One of the "conditions" you can specify when you call dbstop is 'warning'.
dbstop if warning
If you prefer to set this debugging condition via the UI, see the "Error Breakpoints" section of this documentation page.

Kategorien

Mehr zu Debugging and Analysis finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by