CLsqFit:GetCovar CLsqFit:GetErrChan

CLsqFit:GetErrMsg


The GetErrMsg method returns a message describing the error in the least squares fit. If Fit returns false, use this method along with GetErrChan to obtain error information.

Syntax

sMsg = CLsqFit:GetErrMsg()

bullet.gif    sMsg is a string containing the error message.

bullet.gif    nChannel is an optional parameter containing the channel where the error occurred. This is useful only if fitting multi-channel data.

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 = new_lsqfit()

-- create a CLsqFit object

L:SetNumCoefs( 2 )

-- specify the number of coefficients

-- example: you forgot to add points to the fit

 

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

CLsqFit class

GetRetCode

GetErrChan

DoFit

Sprintf

 


Mira Pro x64 Script User's Guide, v.8.73 Copyright Ⓒ 2024 Mirametrics, Inc. All Rights Reserved.