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
 x from y or y from x using a range variable
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

cpeterbeng

Germany
Posts

Posted - 10/22/2012 :  6:17:36 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

JessieWoo

China
46 Posts

Posted - 10/23/2012 :  02:55:46 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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.
Go to Top of Page

greg

USA
1378 Posts

Posted - 10/23/2012 :  09:16:48 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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);
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