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
 x from y or y from x using a range variable

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
cpeterbeng Posted - 10/22/2012 : 6:17:36 PM
Origin Ver. and Service Release (Select Help-->About Origin): Origin Pro 8.6.0 SR2
Operating System: Win7
Hi,
I want to extract the corresponding x value for a given y value or vice versa where the y value comes from a range. I know it is possible to get the x value of a y value on a curve but I want to use a range as my input. For example:

const Dy=32 //this is the y value at wish I want to know the corresponding x value
range ry = [Book]sheet!col(ydata)[25:50]; // col(ydata) is designated Y and has a corresponding x data column in the same sheet.
xfromy(ry,Dy)=; //Some imaginary function returning the x vylue at the y value of Dy

thanks,
Peter
2   L A T E S T    R E P L I E S    (Newest First)
greg Posted - 10/23/2012 : 09:16:48 AM
You can use range notation to do X From Y or Y From X with the caveat that the interpolation works best on sorted data.

range rax = 1; // Use column 1 of the active sheet as our X
range ray = 2; // And column 2 is our Y
range raxy = (rax,ray); // Construct an XY range in 'normal' order
range rayx = (ray,rax); // and one reversed
testy = 0.9;
xval = rayx(testy);
testx = 10.5;
yval = raxy(testx);
JessieWoo Posted - 10/23/2012 : 02:55:46 AM
Hi Peter,

You can try calling vfind X-function to find row numbers, and use it to read cell value. See scripts below:

dataset ds;
range aa = col(2)[10:25];
vfind ix:=aa value:=10 ox:=ds;
range bb = col(1)[10:25];
bb[ds[1]] = ;

For details of vfind X-function, please refer to the following link:
http://wiki.originlab.com/~originla/wiki2/index.php?title=X-Function:Vfind

Best Regard,
Jessie
Originlab Corp.

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