From the code, what I can find is that you defined a dataset "dsExpv" but did not attach it to an existing origin object. This is not valid in Origin C. So you need add a column and attach the column to dsExpv. The code can be changed as following. I have simulated it with F(x) = x^2, it works fine.
static double g0store, t0store;
Dataset dsX("Data1_x");//Dataset for fitting
Dataset dsscaleX("Data1_scaleX");//to get "t0/x"
Dataset dsExpv("Data1_Expv"); //Manually add a column named Expv in Data1
Curve fitFunction("fitFunction_A", "fitFunction_B");//Dataset for F[x]
int nSize= dsX.GetUpperBound();
if(g0!=g0store || t0!=t0store)
{
dsscaleX = t0/ dsX;
dsExpv.SetSize(nSize); //It would be better to set the size of the dataset before using it to avoid some runtime error
for(int ii=0;ii<nSize; ii++)
{
dsExpv[ii] = Curve_yfromX (&fitFunction, dsscaleX[ii]) ;
}
g0store=g0;
t0store=t0;
}
y=g0+Data_table(x, &dsExpv, &dsX);
////End of function
Zachary
OriginLab Technical Services.
Edited by - zachary_origin on 11/14/2006 9:40:02 PM