The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Problems after Upgrade - Access interpolated value
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

SteffenG

Germany
Posts

Posted - 06/16/2011 :  08:22:02 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin 8.5.0G SR1 b161
WinXP

Hi all,

after upgrading to Origin 8.5.0 some of my scripts don't run anymore. Under 8.1 everything runs smooth. Here is the problem:

The script should run over several spectra. These spectra should be weighted with a second static spectra. Because of different x-coordinates I use interpolation. For interpolation I use the aa(bb_x)-construction. This means values from aa are interpolated to fit to x-coordinates defined by bb_x.
With 8.5.0 I get the strange behaviour that inside a for-loop-construction the interpolation is done only ones. After the first iteration aa could be changed (redirected range notation) but the results of the interpolation do not change. Here is the code:

range spektren = [spektren]1!;//worksheet with original spectra;
range augex = [Tvis]2!col(1);//x-coordinates of static spectrum;
range augey = [Tvis]2!col(2);//y-coordinates of static spectrum;
sum(augey);//some simple calculation;
norm_faktor=sum.total;//hold the sum for later usage;
ii=2;//count variable;
for (jj=2;jj<=spektren.ncols;jj++){
range reflexspec = %(spektren)col($(jj));//defines the actual spectrum;
range Tvisy = col(2)[$(ii-1)];//defines a cell in the actual worksheet to hold the result of calculation;
range temp = [Tvis]2!col(temp);//defines a column for temporary use;
mark -m temp;//clears the temporary column;
temp = reflexspec(augex)*augey;//calculates the weighted spectrum with interpolated values of reflexspec;
sum(temp);//some simple calculation;
Tvisy = sum.total/Norm_Faktor;//some simple calculation;
ii++;
};

Please be aware that the code was running very well under Origin 8.1. Within 8.5.0 I get always the result from the first spectrum for all other spectra. If I use the code without the interpolation I get for each spectra different results as expected. Without the interpolation the respective code (marked red) looks like
temp = reflexspec*augey;//calculates the weighted spectrum without interpolation;

I have no idea where this behaviour comes from. I am open for every suggestion to solve this issue.

Best regards,
Steffen

greg

USA
1379 Posts

Posted - 06/16/2011 :  1:38:37 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
There is a bug in 8.5.0 when using a range as a lookup function within a loop. This was fixed in 8.5.1 SR1.

As a workaround, you can use the nameof function to return the range Short Name and use that as your lookup function:

%A = nameof(reflexspec)$;
temp = %A(augex)*augey;
Go to Top of Page

SteffenG

Germany
Posts

Posted - 06/17/2011 :  04:47:20 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks Greg,

I upgraded to Origin 8.5.1 SR 2. Now the problem is gone.

Best regards,
Steffen
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000