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
 Find x of the value near ymax/2
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

a.abc.b35

175 Posts

Posted - 11/08/2015 :  7:14:30 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8.5.1
Operating System:win 7

I have two columns of data X and Y. X is sorted but Y is not and should not be (spectroscopic data). the function has a peak (Ymax), but it decreases at different rates on either side of the peak. As such, for a value of Y closest to Ymax/2 that exists in the Y dataset, there are two X values.

I want to accomplish the following by a brief labtalk script, preferably a one liner:

Get the smallest X value corresponding to that value of Y which is nearest to Ymax/2 existing in the Y dataset.

How do I accomplish that in labtalk? Could you please help?

Even if someone could tell me how to find the two indices of the two Y values closest to Ymax/2 in the Y dataset, it would be great.

Right now I can only find the Labtalk function "xindex" which works with the corresponding x dataset but my problem is different.
Thanks,
AB





AB

Edited by - a.abc.b35 on 11/08/2015 7:23:06 PM

jasonzhao

China
262 Posts

Posted - 11/08/2015 :  9:19:00 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

You can try to use the levelcrossing X function in LabTalk Script:


http://www.originlab.com/doc/X-Function/ref/levelcrossing
For example:

levelcrossing iy:=col(2) level:=max(col(2))/2 type:=left xindex:=<new>;



Best regards!
Jason
OriginLab Technical Service
Go to Top of Page

a.abc.b35

175 Posts

Posted - 11/08/2015 :  9:49:04 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
That seems to work; thanks Jason.

AB
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