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
 Origin Forum
 Column Name as Function Parameter
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

jeffsecor

USA
1 Posts

Posted - 06/17/2013 :  1:02:16 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello,
This may be a basic question , but I can't find a basic answer anywhere.

I am using the 3d parametric plot in origin9. As a test, I am making a paraboloid. So x(u,v)=u , y(u,v)=v and z(u,v) is my question.

In the script before window, I made a test function
\double a;
double b;
function double test(a,b,u,v)
{
return a*u^2+b*v^2
}
\
Now if I enter into the z(u,v) window something like

test(1,2,u,v)

It will correctly plot the paraboloid with parameter "a" as 1 and parameter "b" as 2. What I want to do is enter a column name into the z(u,v) box. i.e. I have a book with column named NY, and another column named MEX, each with two rows for the paraboloid parameters. I expect the code something like


z(u,v)= test(Col(MEX),u,v)
---before script window---
double a;
double b;
function double test (Col(NAME),u,v)
{
a=Col(NAME)[1];
b=Col(NAME)[2];
return a*u^2+b*v^2
}

But I dont know the correct syntax to do this, i.e. have a column as a parameter and a general column designation in the function code.

Jeff Secor

greg

USA
1378 Posts

Posted - 06/19/2013 :  10:35:23 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The first two arguments (a and b) defaulted to type double and you cannot use a dataset for both and expect origin to understand you mean to use the first two rows of the dataset.

In the Before Formula Script, add this line:

range raMex = [Book1]Sheet1!Mex;

Then for z(u,v) you can use:

test(ramex[1],ramex[2],u,v)

As you change the two values in the MEX column, your graph should update automatically.
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