CLsqFit:SetPtStatus


The SetPtStatus method sets the status of am existing sample point.

Syntax

CLsqFit:SetPtStatus( nIndex, sStatus )

CLsqFit:SetPtStatus( nIndex, sStatus, nChannel )

where

    nIndex is the index of the point in the sample, beginning at index 1.

    sStatus is a string indicating the status value to assign the point. If the data is multi-channel and the nChannel argument is not specified, then you should combine status values for all channels into a single comma-separated string.

    nChannel is the optional channel to select for multi-channel data.

  

The point status has 3 states: Use, Rejected, and Deleted. The corresponding names used in a script are "Use", "Rej", and "Del". The current method may be used to switch between different status values. When a point is added to the sample it acquires the "Use" status. If data rejection is enabled and the point is rejected, it acquires a "Rej" status and is not used in the fit. Likewise, the present method may be used to manually delete a point so it is not used in the fit. A deleted or rejected point's status may be changed to "Use" by the current method or using the UndeletePt method.

The GetPtStatus method uses the index of the target point. The index must either be known from the order that points were added to the sample, or determined by matching the target point's values using FindPt or a more complicated procedure involving GetResid or other method.

Two formats are provided. If the point has a single channel value (i.e., typical numeric data) or you want to sets the status of only a single channel, pass a single value for the status. If the point involves multi-channel data, up to 4 status values may be passed by combining them in a multi-channel string separated by commas.

Example

The following example illustrates how to change the status of a sample point. In this case, the target point's index is found by matching its values:

L = CLsqFit:new()

-- create a CLsqFit object

L:SetNumCoefs( 2 )

-- set 2 coefficients to fit a line

L:AddPt( 3.5, 5.15 )

-- add a point for x = 3.5, y = 5.15, weight = 1

 

-- add more points

L:Fit()

-- Fit the line

 

-- do something with the fit results

n = L:FindPt( 3.5, 5.15 )

-- find the point (if we don't know it has index 1)

L:SetPtStatus( n, "Del" )

-- mark the point as "deleted"

L:Fit()

-- get a new fit with the point deleted

Related Topics

GetPtStatus

AddPt

FindPt

DeletePt

CLsqFit class