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
 LabTalk Forum
 Find x of the value near ymax/2

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
a.abc.b35 Posted - 11/08/2015 : 7:14:30 PM
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
2   L A T E S T    R E P L I E S    (Newest First)
a.abc.b35 Posted - 11/08/2015 : 9:49:04 PM
That seems to work; thanks Jason.

AB
jasonzhao Posted - 11/08/2015 : 9:19:00 PM
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

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