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
 cell data
 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 - 09/25/2002 :  08:15:24 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi, all,

If x=0.5, how could i get y(0.5)=?

thanks,

moondream

Mike Buess

USA
3037 Posts

Posted - 09/25/2002 :  1:07:48 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi moondream,

First, let's make sure I understand what you want to do. You want to find a value in a Y column based on its corresponding X value rather than its row number? If I'm wrong pls ignore the rest of this message and set me straight. If I'm right then read on.

In a typical worksheet with data1_A as the X column and data1_B as the Y column you can find the Y value who's X value is exactly 0.5 like this...

ii=list(0.5,data1_A) // find the first row with X value = 0.5
data1_B[ii]=; // type the corresponding Y value

If 0.5 is not found you'll get data1_B[0]=--. It's slightly more complicated to find the Y value who's X value is closest to 0.5, but it can be done using the xvalue() and xvalue1() functions. If that's what you need let me know and I'll explain later.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 09/25/2002 1:13:29 PM
Go to Top of Page

Barb Tobias

USA
305 Posts

Posted - 09/25/2002 :  4:34:01 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Here's some more information to consider...
You can also use the following notation in the Script window:
yDataSet(xValue) =
In this notation, Origin uses linear interpolation/extrapolation on the X data set and/or Y data set, as needed.
Example,
Data1 worksheet
A(X) B(Y)
1 2
2 4
3 6
4 8
Enter the following in the Script window:
data1_b(2)=
Origin returns 4.
Enter:
data1_b(2.5)=
Origin returns 5.
-Barb



Edited by - Barb Tobias on 09/25/2002 5:00:26 PM
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 09/25/2002 :  4:58:56 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The Table function is the best way to do this, using the data above,

table(data1_a, data1_b,2.5)=;
TABLE(DATA1_A, DATA1_B,2.5)=5
table(data1_b, data1_a,7)=;
TABLE(DATA1_B, DATA1_A,7)=3.5

so you get get x from y or get y from x easily.

CP


Go to Top of Page

moondream

Netherlands
22 Posts

Posted - 09/26/2002 :  07:49:17 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks all, all of it work.
but why couldn't I use col(b)(0.5)= ?


thanks again,

moondream
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 09/26/2002 :  11:10:41 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

quote:

but why couldn't I use col(b)(0.5)= ?



I always think that Origin's syntax for functions is like:
    <FUNCTION_NAME>(argument)
But, col(b) is not a function name, but data1_b is a "name".
For me, the form like col(b)(0.5) is very confusing, and may potentially cause an ambiguity (Is 0.5 the argument of "col"? or of "(b)"?).

--Hideo


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