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 for Programming
 Forum for Origin C
 how to use user function to set column value?

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
austin75 Posted - 04/22/2011 : 09:41:55 AM
Origin Ver. and Service Release (Select Help-->About Origin): 8.0 SR1
Operating System: windows 7

I have experience on c programing (not using it for more than 10 years), but very new to origin c. Here is my question. I have a workbook with several columns, I can click any one column to make it active. Here comes the first question: how to check which column is active in origin c? Next, I will manually create a new column and use the set column value to fill this column based on the previous active column I was choosing with an user defined function called abcfun. Following is the definition of this function in c. Although I can build this function in code builder smoothly, but I can not get it work when I use it in the "set column values" dialogue. Any suggestions will be highly appreciated. Thanks.


// rr is elements in active column
// tt is the value needed for new column

double abcfun(double rr)
{
double x;
double tt;
if (rr>825)
{x=(2*log(rr)-7.6)/1.8; tt=2.9-3.5*x+2.7*x^2;}
else
{x=(2*log(rr)-4.8)/1.0; tt=47.8-62.9*x+48.9*x^2;}
return tt;
}
3   L A T E S T    R E P L I E S    (Newest First)
Penn Posted - 04/25/2011 : 01:19:26 AM
Hi A.S.,

When you use the log function, you need to include the origin.h header file. And this header file is included by default when you create the .c file in Code Builder. So, actually, you don't need to include this header file manually.

Penn
austin75 Posted - 04/24/2011 : 10:54:35 PM
Thank you Penn.

For this user defined function, do I need to include some additional header file to use log() function? Thanks.

A.S.
Penn Posted - 04/24/2011 : 10:15:11 PM
Hi,

You can use the GetSelectedColumns method to get the active columns.

After you build the defined function (the one you posted) successfully, you can just use it in the Set Column Values dialog. See the image below:



Penn

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