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
 Origin Forum
 Column Name as Function Parameter

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
jeffsecor Posted - 06/17/2013 : 1:02:16 PM
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
1   L A T E S T    R E P L I E S    (Newest First)
greg Posted - 06/19/2013 : 10:35:23 AM
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.

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