Removes elements having the missing value (NANUM) from the right end of the vector.
int TrimRight( BOOL bDelExtra = FALSE )
Returns -1 on error, >=0 on success, and N > 0 for number of cells deleted.
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}; }
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.
vectorbase::Trim, vectorbase::TrimLeft, vectorbase::GetUpperBound, vectorbase::GetSize, vector::vector
origin.h