2.2.3.19.42 vectorbase::TrimRightTrimRight
Description
Removes elements having the missing value (NANUM) from the right end of the vector.
Syntax
int TrimRight( BOOL bDelExtra = FALSE )
Parameters
- bDelExtra
- [input] TRUE will delete cells on the right of (after) the last valid numeric value, FASLE will cause the upper bound or index to be adjusted downward but no cells are deleted.
Return
Returns -1 on error, >=0 on success, and N > 0 for number of cells deleted.
Examples
EX1
void vectorbase_TrimRight_ex1()
{
// The current window is Worksheet with two columns
Worksheet wks=Project.ActiveLayer();
if (wks)
{
Dataset dsA(wks,0);
Dataset ds1(wks,0), ds2(wks,1);
dsA.TrimRight(TRUE);
Curve crvAxBy(ds1, ds2);
crvAxBy.TrimRight(TRUE);
LT_execute("doc -uw");
}
}
EX2
void vectorbase_TrimRight_ex2()
{
vector vecData = {0.1,0.2,0.3,0.4};
vecData[2] = NANUM;
vecData[3] = NANUM;
//Source data: vecData = {0.1,0.2,NANUM, NANUM};
vecData.TrimRight(true);
//Result Data: vecData = {0.1,0.2};
}
Remark
TrimRight removes elements having the missing value (NANUM) from the right end or bottom of vectorbase derived objects by retarding the upper index to the last valid numeric value. If bDelExtra is set to TRUE cells containing NANUM are deleted from the vectorbase object. When bDelExtra is TRUE TrimRight of Curve objects causes both X and Y Datasets to be trimmed.
See Also
vectorbase::Trim, vectorbase::TrimLeft, vectorbase::GetUpperBound, vectorbase::GetSize, vector::vector
Header to Include
origin.h
|