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
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 baseline subtraction

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

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

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000