CLsqFit:GetErrChan


The GetErrChan method returns the channel at which a fit error occurred. If Fit returns false, use this method along with GetErrMsg to obtain error information.

Syntax

nChannel = CLsqFit:GetErrChan()

where

    nChannel is a number indicating the channel where the error occurred.

Example

The following script configures the fit but forgets to add any data points. After the fit fails, the script prints an error message and exits.

L = CLsqFit:new()

-- create a CLsqFit object

L:SetNumCoefs( 2 )

-- specify the number of coefficients

 

-- forget to add data points

bSuccess = L:Fit()

-- do the fit

if not bSuccess then

-- test whether the fit succeeded

  n = L:GetErrChan()

-- get the error channel

  s = L:GetErrMsg(n)

-- get the error message

  Exit( Sprintf("Error [%d] %s\n", n, s ) )

-- exit the script and list the error message

end

-- end of test block

Related Topics

GetErrMsg

Fit

CLsqFit class