Work Around a Curve Fit Error

I am using the user defined CurveFit function, which works like a charm by the way!!

However, I have some instances of fitting that yield a singular matrix and cause the fitting to fail.

I would like to recover from this error and continue to the next instance of fitting but presently cannot find a way to suppress the message and move on.

Does anyone have similar experience with a fix??

You can create a special variable, "V_FitError" to catch the error. To learn more about that, read in the help: DisplayHelpTopic "V_FitError and V_FitQuitReason"

Your code will look like this (careful- uncompiled and untested pseudocode):

    Variable V_FitError=0
    FuncFit ...
    if (V_FitError)     // non-zero on any error
        if (V_FitError & 2) // a singular matrix error
            ... do something appropriate, which might be ...
            continue    // skip doing what you ordinarily do, and simply go to the next fit
while(I should continue fitting)

You might wish to look through the list of errors and add handling for them as well.

You might also wish to look at V_FitQuitReason. That variable reports an abnormal termination that isn't considered to be a real error. The distinction may be subtle :)




Igor Pro 8

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More