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
 subtract straight line command
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

moondream

Netherlands
22 Posts

Posted - 05/27/2002 :  04:27:37 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,
I want to integrate a peak with an inclined baseline, but I could not find direct menu in origin 6.0, so I think the command "substract straight line" under analysis menu may be useful, while I am quite confused about the script for this command, is there someone can explain the following script for me, how does it work? and is there a simple script can integrate a peak with inclined baseline?

#Pick two screen pts and subtract %C from the line formed
create _line -M 3;set _line -l 1;
def EndToolbox (;undo %C;%C --O _Line;del _line;rescale);
GetPts -n _line 2
[Double-click to set straight line begin..]
[Double-click to set straight line end..];


thanks alot
moondream

Jose

Netherlands
93 Posts

Posted - 05/27/2002 :  05:49:39 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
create _line -M 3;set _line -l 1;


This creates a new dataset named _line and its associated X dataset _line_A, with 3 rows. Then sets its line connection type to 'line'.

def EndToolbox (;undo %C;%C --O _Line;del _line;rescale);


This defines a special macro, 'EndToolbox', that is to be run AFTER you select the two points that determine your substracting line in the next step. Inside this macro you find four commands:

1. Creates a backup of the current dataset so you can 'undo' later if you want.
2. Substracts your _line dataset from your currently selected data (%C).
3. Deletes the _line dataset.
4. Rescales the graph to show all data.

GetPts -n _line 2
[Double-click to set straight line begin..]
[Double-click to set straight line end..];

This asks you to select two XY points in the graph that are going to be kept in the _line dataset. The Screen Reader tool is activated to allow you to do it. After you do that, the Screen Reader tool is de-selected and the 'EndToolbox' macro is triggered, making the substraction.

The substraction in step 2 above is done with interpolation inside and outside (-O) the range you have selected, so your two selected points are enough to define a straight line to do that operation.


Jose Via, Origin WebRing member
Go to Top of Page

moondream

Netherlands
22 Posts

Posted - 05/27/2002 :  09:31:08 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Jose, Thank you very much.
your explanation is perfect!
while where can I get these informations as you explained. I can not find much more in help file.

cheers,
moondream
Go to Top of Page

Jose

Netherlands
93 Posts

Posted - 05/27/2002 :  11:25:41 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
All I've explained above was taken from the LabTalk help file that comes with the program. Go to the Search tab and type the command or macro names above to get information about them.

Good to hear that it was useful


Jose Via, Origin WebRing member
Go to Top of Page

MarkusSt

1 Posts

Posted - 12/23/2017 :  09:29:01 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

it works, but I would need to save the subtracted data in a new row in the worksheet, and leave the original data unchanged.

How can i do that?

Thx,
Markus
Go to Top of Page

yuki_wu

896 Posts

Posted - 12/25/2017 :  03:45:25 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Markus,

You can try the X-Function subtract_ref, for example:

// Subtracts XY pair in cols 3&4 from XY pair in 1&2 and puts subtracted XY pair in cols 5&6.
subtract_ref iy1:=[Book1]Sheet1!(1,2) iy2:=[Book1]Sheet1!(3,4) oy:=[Book1]Sheet1!(5,6)

More info please find here:
https://www.originlab.com/doc/X-Function/ref/subtract_ref

Regards,
Yuki
OriginLab

Edited by - yuki_wu on 12/25/2017 03:45:57 AM
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