T O P I C R E V I E W |
belmore |
Posted - 06/11/2007 : 1:20:57 PM Origin Version 7.5Pro Operating System: Win Vista
Hello: I work with visible light absorption spectra consisting of wavelength (x) and absorption values (y). Frequently, I need to do baseline correction by selecting a y-value where the species of interest does not absorb light and then subtracting this from the y-column. What I want to do is input a wavelength (value in the x-column) and then have y-value in that row subtract from the entire column.
My problem is, I do not any experience with Origin C or any flavor of C. I think I need something more basic than the information given in the tutorial.
Any suggestions/references for a complete newbie?
Edited by - belmore on 06/11/2007 1:43:18 PM |
6 L A T E S T R E P L I E S (Newest First) |
belmore |
Posted - 09/16/2009 : 1:02:12 PM Works like a charm!
Thank you.
I apologize for not updating my software.
Regards, Brad |
easwar |
Posted - 09/14/2009 : 8:58:57 PM Hi Brad,
The "int ii" inside the for loop is only supported starting in Origin 8. My apologies, you have Origin version 7.5 so try this script instead, where the "int" is dropped:
for(ii=2; ii<=wks.ncols; ii++) { wcol(ii) -= wcol(ii)(848); }
If that does not work, please send an e-mail to us with your project/data.
Easwar OriginLab
|
belmore |
Posted - 09/14/2009 : 3:19:17 PM Sorry, Easwar:
I can't get that simple script to work.brad |
easwar |
Posted - 09/14/2009 : 2:35:46 PM Hi,
You can do this as a simple loop operation from the script window. Use Window:SCript window menu item to open the script window. Then with your XYYY... worksheet active, paste these lines and select them all and press Enter:
for(int ii=2; ii<=wks.ncols; ii++) { wcol(ii) -= wcol(ii)(848); }
Note: Replace the number 848 above with whatever is the wavelength number you need. The wcol(ii)(848) notation will find the Y value at that number, and if the exact number does not exist in your X column, it will interpolate to find the y value at that x and then subtract that interpolated value.
If you need more help please contact tech support.
Easwar OriginLab
|
belmore |
Posted - 09/14/2009 : 1:39:24 PM More help required.
This solution works fine if I have only one Y-column of data. But I have one X-dolumn (wavelength) and many Y-columns (Absorbance values).
I want all the columns in worksheet to subtract the value of that individual column's value at a single wavelength
Thanks
|
Mike Buess |
Posted - 06/11/2007 : 2:26:13 PM Add the following function to CodeBuilder's workspace as explained here and run it by entering subtractYatX(wavelength) in the script window. Function assumes X and Y are in cols 1 and 2, respectively.
void subtractYatX(double dXval) { Worksheet wks = Project.ActiveLayer(); Curve cc(wks, 0, 1); double dYval = Curve_yfromX(&cc,dXval); cc -= dYval; }
Mike Buess Origin WebRing Member |