quote:
Originally posted by couturier
Origin Ver. and Service Release (Select Help-->About Origin): 2017SR2
Operating System:win10
Hi,
I'm trying to find the LT copy -s equivalent operation in OriginC:
I have a vector with N1 pts, and I'd like this vector to become N2 pts, without the need of specifying an input and output X vector.
Thanks for your help
Simply apply the linear interpolation to your data.
bool lt_copy_s(vector<double>& values, size_t npts)
{
size_t nSrcSize = values.GetSize();
vector<double> SrcX;
SrcX.Data(0.0, nSrcSize - 1, 1.0);
vector<double> X, Y;
double delta = (values.GetSize() - 1.0) / (npts - 1.0);
X.Data(0.0, values.GetSize() - 1, delta);
Y.SetSize(X.GetSize());
int nRet = ocmath_interpolate(X, Y, npts, SrcX, values, nSrcSize);
if(nRet != OE_NOERROR)
return false;
values = Y;
return true;
}
#####
#### _\_ ________
##=-[.].]| \
#( _\ | |------|
# __| | ||||||||
\ _/ | ||||||||
.--'--'-. | | ____ |
/ __ `|__|[o__o]|
_(____nm_______ /____\____