Hi!
Short Question: I would like my code to perform in a certain way if a warning is issued, no matter the warning. Something like
dbstop if warning
however I do not want it to stop but to break the loop or do other things. Is there a function which I can use in an "if" statement? The only possibility I found was the try – catch blcok but as far as I got, that requires to know your error.
Details/Long Q.: I have a function that takes input and does matrix inversion on many matrices. Sometimes the input is bad (it is randomly generated) and the determinant is say 0, NaN, -Inf, etc. Matlab gives me a warning for that and I want it, as soon as it sees its own warning, to stop executing the funciton and return, so that it can draw again. I used conditional statements at first (if isnan(det(A)) return; end for example), but I have many matrices and the combinations are too many to do it manually. What would be a nice way to do it?
Best Answer