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
 Accessing spline 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

aeolian1

Germany
Posts

Posted - 06/06/2014 :  12:12:59 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 9.0.0
Operating System:

Hello,

I attempted without success to use the "%c" method as described in http://www.originlab.de/www/support/resultstech.aspx?language=english&ID=101 to extract the values of a Bezier curve from a graph and place them in a worksheet, but was unsuccessful: the values in data2_b are just all the values of the data points, not the values of the Bezier curve through them. I realize that in a Bezier curve in Origin, the first point of every group of 3 is just the data point value, but the second and third points of each 3 in data2_b should be the Bezier curve values, and not the data point values. The tip in this link applies to version 7.5 - perhaps that is the problem. Is there a modification of this method that will allow it to work via Labtalk in version 9.0?

Thank you very much.

lkb0221

China
497 Posts

Posted - 06/06/2014 :  4:03:22 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

You should use interp1 X-function instead of that old method.
http://www.originlab.com/doc/X-Function/ref/interp1

Zheng
OriginLab
Go to Top of Page

aeolian1

Germany
Posts

Posted - 06/10/2014 :  09:11:18 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you, Zheng. Could you please clarify exactly how to implement this? Let's say I have a plot with the X column named "periodNum" and the Y column named "yoffsON", with the points connected by a Bezier curve. If I want to get the values of the Bezier curve at the X values contained in column X and put those values in a column named yoffsONi, I suppose I need to

1. Activate the plot window.

2. Run seomthing like the following code in the script window:

interp1 ix:=periodNum iy:=yoffsON oy:=yoffsONi method:=Bezier;


However, this code produces the error "Error: cannot find a (unique) variable corresponding to oy", instead of placing the values of the Bezier curve in the column yoffsONi. By the way, the column yoffsONi was previously created in the corresponding worksheet. Could you please tell me how to fix the code? Thank you.

Go to Top of Page

aeolian1

Germany
Posts

Posted - 06/10/2014 :  11:08:18 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
P.S. I tried

win -a y0_ON_copy;
range Fitt=[FitR1]1!;
range iyx=%(Fitt)Col(1);
range iyy=%(Fitt)Col(3);
interp1 ix:=iyx iy:=iyy ox:=%(Fitt)Col(6) method:=Bezier;

Here, the XY data for interpolation is in X = Col(1), Y = Col(3), and the line connecting them on the plot is a Bezier curve. The above code produces a command error, and if I replace "Bezier" with "spline", it just puts the Col(3) values in Col(6) (instead of the spline values). So, the problem is still the same as in my original message.

More importantly, it seems that method:=Bezier is not allowed in interp1. The option "create Bezier data" is available on the plot, however, and that's what I'd like to do: just create the Bezier data. If interp1 can't handle Bezier curves, what command should I use? Thank you.
Go to Top of Page

lkb0221

China
497 Posts

Posted - 06/10/2014 :  4:30:40 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Well... Sorry I didn't notice that you are looking for a Bezier interpolate.
I'm sorry that there is no script access to generate this data, so the contact menu might be the only way.

Besides, the second and the third points are the "control points" of Bezier curve.

Zheng
OriginLab

Edited by - lkb0221 on 06/10/2014 4:35:24 PM
Go to Top of Page

aeolian1

Germany
Posts

Posted - 06/11/2014 :  03:23:35 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you for your reply. I don't understand it completely:

1. What is the "contact menu", and how can I access it via Labtalk? I know that "menu commands" like "menu -e 57634" exist - can I use such a command to access the menu command "create Bezier data" that is available on the plot? If so, what is the specific command?

2. "Besides, the second and the third points are the "control points" of Bezier curve": could you please explain what you mean by this? I know that for a Bezier curve, the 1st, 4th, 7th, etc. points are just the data points themselves, but the 2nd, 3rd, 5th, 6th, etc. points should be the Bezier values that I am trying to access via Labtalk.
Go to Top of Page

aeolian1

Germany
Posts

Posted - 06/11/2014 :  04:48:23 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I forgot my third question:

3. Could you please tell me what is wrong with the above code fragment when I use method:=spline?

I would really appreciate it if you could answer all three questions. Thank you!
Go to Top of Page

aeolian1

Germany
Posts

Posted - 06/11/2014 :  09:25:40 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
A P.S. to my question #1:

If I select "Create Bezier data" from the menu that I get if I right-click on the Bezier curve, I get a new worksheet that contains the Bezier data. This is the data I'm trying to access via Labtalk.

If I press Ctrl-Shift while selecting "Create Bezier data", I see "Menu id=38081" in the script window. The data points in the plot are "highlighted" (turn white), but no worksheet containing the Bezier data appears. If I run

menu -e 38081;

as a Labtalk command, the data points in the plot are again "highlighted", and again no worksheet containing the Bezier data appears. How can I get that worksheet to appear via a Labtalk command? Thank you.
Go to Top of Page

lkb0221

China
497 Posts

Posted - 06/11/2014 :  09:30:22 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

1). Should be context menu, sorry it's a typo. Althrough we do have DoMenu marco, but there is no LT access to select the curve.

2). Our bezier curve is 3rd-order. So if you want higher, you need to calculate by yourself.
https://en.wikipedia.org/wiki/B%C3%A9zier_curve

3). Please see the interp1 page, there is no bezier option for method. "method:=spline" should work. Besides, you can use index number to indicate the options, like "method:=2".

Zheng
OriginLab
Go to Top of Page

aeolian1

Germany
Posts

Posted - 06/11/2014 :  09:41:13 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you for your response. I have two follow-up questions:

1. Can you please tell me exactly what is wrong with the code fragment

win -a y0_ON_copy;
range Fitt=[FitR1]1!;
range iyx=%(Fitt)Col(1);
range iyy=%(Fitt)Col(3);
interp1 ix:=iyx iy:=iyy ox:=%(Fitt)Col(6) method:=spline;

Here, the XY data for interpolation is in X = Col(1), Y = Col(3), and the line connecting them on the plot is a spline curve. This code just puts the Col(3) values in Col(6) (instead of the spline values that I want). So, the problem is still the same as in my original message.

2. About the "Create Bezier data" option from the context menu: can I somehow use "menu -e 38081" to do what I want (combined with some additional command)?

Thank you in advance for your answers to both questions.
Go to Top of Page

lkb0221

China
497 Posts

Posted - 06/11/2014 :  10:12:16 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Because spline will still pass all the points of your original data. interp1 is to find corresponding value of those points that are not in you original XY data but on the curve. Like "Find Y by X".

To higher the data density, you may use interp1xy X-function.
http://www.originlab.com/doc/X-Function/ref/interp1xy

There is no LT access to get that Bezier data, at least none as I can come up with. Yes, "DoMenu 38081" can return the workbook once the curve is selected, but you need to select it (click it one the graph) first to make to work, for that it's a context menu.

LT can only make a curve activated, but not selected.

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