Author |
Topic  |
|
HansBrouwer
Netherlands
Posts |
Posted - 08/01/2005 : 10:03:33 AM
|
Hi everybody,
My name is Hans Brouwer. I have been working with origin for a very short time, so i am really fresh. It could be that i am boring some of you with my questions, but i would like to have some advice about Interpolating Data in Labtalk.
I have a worksheet containing say 1000 columns Y and 1 column X. I would like to interpolate all these columns. Manually it is done by selecting X and one of the Y, Plot it and then interpolate the graph using the Analysis-Interpolate/Extrapolate option.
I have tried to obtain information from the Programming Help file. Could be that i am not looking hard enough, or that it is not there. Could anyone help me out here?
Best Regards,
Hans Brouwer |
|
Mike Buess
USA
3037 Posts |
Posted - 08/01/2005 : 11:10:20 AM
|
Hi Hans,
This is probably better done in Origin C but you can also use LabTalk's Table function. Assume your data are in Data1 with first col A(X). Create a new worksheet Data2 and fill its col A(X) with the X values at which you want to interpolate. Next, delete all Y columns in Data2. Finally, run this script...
%W=Data1; win -a Data2; // activate results wks loop (i,2,%W!wks.ncols) { wo -a 1; // add Y column to Data2 %(%H,i)=Table(%(%W,1), %(%W,2), %(%H,1)); };
I'm not sure what type of interpolation (probably linear) is used by the Table function but it has produced reasonable results when I've used it.
...A more detailed description of the Table function is available in the Knowledge Base.
http://www.originlab.com/www/support/resultstech.aspx?ID=680&language=English
Mike Buess Origin WebRing Member
Edited by - Mike Buess on 08/01/2005 11:15:16 AM
Edited by - Mike Buess on 08/01/2005 11:27:28 AM |
 |
|
HansBrouwer
Netherlands
Posts |
Posted - 08/01/2005 : 4:39:37 PM
|
Hey Mike,
Thank you for helping me out!! I am not at work now, but i will use your script tomorrow morning.
Best regards,
Hans |
 |
|
HansBrouwer
Netherlands
Posts |
Posted - 10/25/2005 : 10:59:58 AM
|
quote:
Hi Hans,
This is probably better done in Origin C but you can also use LabTalk's Table function. Assume your data are in Data1 with first col A(X). Create a new worksheet Data2 and fill its col A(X) with the X values at which you want to interpolate. Next, delete all Y columns in Data2. Finally, run this script...
%W=Data1; win -a Data2; // activate results wks loop (i,2,%W!wks.ncols) { wo -a 1; // add Y column to Data2 %(%H,i)=Table(%(%W,1), %(%W,2), %(%H,1)); };
I'm not sure what type of interpolation (probably linear) is used by the Table function but it has produced reasonable results when I've used it.
...A more detailed description of the Table function is available in the Knowledge Base.
http://www.originlab.com/www/support/resultstech.aspx?ID=680&language=English
Mike Buess Origin WebRing Member
Edited by - Mike Buess on 08/01/2005 11:15:16 AM
Edited by - Mike Buess on 08/01/2005 11:27:28 AM
|
 |
|
HansBrouwer
Netherlands
Posts |
Posted - 10/25/2005 : 11:03:14 AM
|
Hi Mike,
It has been a while since i posted this question. Now i finally had to use your program. After running this program, the Data2 worksheet contains the same number of Y columns as Data1, but all columns are filled with the same numbers.
Could you help me out?
Best Regards,
Hans Brouwer |
 |
|
Mike Buess
USA
3037 Posts |
Posted - 10/25/2005 : 11:22:42 AM
|
Hi Hans,
Try replacing %(%W,2) with %(%W,i) in the Table command.
Mike Buess Origin WebRing Member |
 |
|
HansBrouwer
Netherlands
Posts |
Posted - 10/26/2005 : 03:33:47 AM
|
Hey Mike,
Thanks Alot!! My spectra look great. Best wishes,
Hans |
 |
|
|
Topic  |
|
|
|