CLsqFit:DeletePt


The DeletePt method sets the status of an existing point to "Del", meaning that the point is deleted and will not be used in the fit. You can later restore the point using the UndeletePt method.

Syntax

CLsqFit:DeletePt( nIndex )

CLsqFit:DeletePt( nIndex, nChannel )

where

    nIndex is the index of the point.

    nChannel is an optional parameter which specifies the channel to delete. If omitted, all channels are deleted.

Examples

The following example illustrates how to change the weight of an existing 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

L:AddPt( 3.5, 5.15 )

-- add a point for x = 3.5 and y = 5.15

 

-- add more points

L:Fit()

-- Fit the line to all points

 

-- 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:DeletePt( n )

-- delete the point

L:Fit()

-- get a new fit result without the point

Related Topics

UndeletePt

SetPtStatus

AddPt

CLsqFit class