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
 problems about "Set Columns Values"

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
hfkenny Posted - 12/18/2006 : 05:23:38 AM
Origin Version (Select Help-->About Origin): 7.5
Operating System: WinXP

Dear all:

I got 2 problems about "Set Columns Values":

1. Is it possible to set a column values according to the values of another column? Saying, the values of column B will be 0 when the values of column A is negaetive and vise versa.(row by row)

2. How can I associate my own C code with "add function" button? or how can I add a new function of my own into the "add function" downlist?


Thanks!!

hfkenny
9   L A T E S T    R E P L I E S    (Newest First)
hfkenny Posted - 12/23/2006 : 10:08:52 AM
Hi,Mike:

I tried "treplace" function and found it can work in a "Set Column Values" expression. you can try the example listed under "programming / tReplace" item. But this seem no help to my problem.

hfkenny
Mike Buess Posted - 12/21/2006 : 09:15:06 AM
Hi hfkenny,

tReplace acts on an entire dataset and will not work in a Set Column Values expression. You must use it from the script window.

Mike Buess
Origin WebRing Member
zachary_origin Posted - 12/21/2006 : 05:36:08 AM
Hi,
You may use the method 2 Mike has suggested. Leo has mentioned a tutorial for how to add a funtion.

Zachary
OriginLab Technical Services.
hfkenny Posted - 12/21/2006 : 05:02:20 AM
Dear all:

Thank you for your kind reply.

I've got a new problem now. When calculation of "arctan(a/b)", the result has to be modified according to the value of b: if b>0, no modification is needed; if b<0, the result should be added with pi(3.14159),and if b=0, then the value of "a" should be taken into consideration: a>0, the result should be +pi/2; a<0, the result be -pi/2 ,and a=0, a missing number. How can I realise this in "set column values"? I tried treplace function and it seems not to work.

hfkenny
Mike Buess Posted - 12/19/2006 : 09:59:03 AM
Thanks, Zachary... flattery will get you everywhere. :) The ternary operator is indeed in the programming guide.

LabTalk Language Reference > Overview... > Operators > Conditional Operators

There Origin's tReplace function is also discussed. It is more powerful and faster than the ternary operator but is also more difficult to use.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 12/19/2006 09:59:50 AM
Leo_Li Posted - 12/18/2006 : 11:31:06 PM
Try this tutorial:

Origin Menu: Help->Tutorial
Tutorial 15: Adding a New Function (and call it in "Set Col Values" dialog)

Leo

zachary_origin Posted - 12/18/2006 : 9:50:50 PM
Hi hfkenny,

Mike knows so many deep things of Origin because he has used it for more than ten years. He almost knows everything for Origin... :)

To be familiar with Origin, I think the most useful handbook is the Help file in Origin though it contains many many chapters...

Zachary
OriginLab Technical Services.
hfkenny Posted - 12/18/2006 : 9:21:07 PM
Dear Mike:

I tryed the ternary operator and it indeed works! I wonder how you can know this! Could you please give me some clue to find a comprehensive usage handbook about Origin? Anyway, Thank you very much for your help and I also give my best wish to you for the coming Christmas and New year!

hfkenny


Mike Buess Posted - 12/18/2006 : 06:52:02 AM
hfkenny,

1. Use the ternary operator. This sets col(B) to value1 if col(A)<0 and value2 otherwise.

col(B) = col(A)<0 ? value1 : value2

2. You can't add you function to the Add Function list but you can use it in the Set Column Values expression anyway as long as it's compiled...

col(B) = MyFunction(col(A));

Mike Buess
Origin WebRing Member

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