Hi,
I am trying to perform operation on all the sheets of a specific workbook. The steps are:
1- Compute log(col(2)) of each sheet and save the values in a new column in each sheet.
2- Perform a linear fit of these new column created from row 5 to row 10 and save the result in a new column in each sheet.
3- Calculate the area of the linear fits saved in each sheet and save these values in a new workbook. Each area value should be identified by the sheet name where it comes from.
I order to to do I have tried this:
doc -e LB
{
int j = 1;
if (%H == "DatosMelanina")
{
loop(ii,1,page.nlayers)
{
string str = layer$(ii).name$;
rW.addCol(LogR);
range Reflectance = [%H]$(ii)!2;
range logR1 = [%H]$(ii)!3;
logR1 = -log(Reflectance);
rW.addcol(FitData);
fitLR iy:=(1,3) N:=(5,10) oy:=col(FitData);
range Fit = [%H]$(ii)!FitData;
newbook MelaninIndex;
integrate Fit;
range Area = [MelaninIndex]Sheet1!2;
range Name = [MelaninIndex]Sheet1!1;
Area[j] = integ.area/100;
Name[j]$ = str$;
j++;
}
}
}
But the next error shows:
layer$(ii).name$
string expression error!
STR:failed to add variable to local stack!
Also, the result I get is:
1- log(col(2)) is performed correctly
2- LinearFit is only performed in the first sheet and not the next ones.
3- Only the area of the first sheet is saved in the new workbook and not the next ones.
I don't know how to solve this.
Thanks in advance for the help.
I am using Origin Pro2016
Operating System: Windows 10