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
 LabTalk Forum
 Merging two columns into one column

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
karvek Posted - 10/17/2019 : 11:33:37 AM
Hi,

I think I am trying to do something really stupid but I cannot manage somehow.

I have two columns and I want to create a third column formed by certain specific ranges of the previous columns.

If I put
range r1 = A[1:10]
range r2 = B[11:20]
as before formula script I can assign the range values using r1 or r2 but I don't understand which operation should I use to append r2 to r1.

Writing r1+r2 makes the sum, but I actually want a simple column formed by two different column ranges...

Anyone has a suggestion on how to do it?
Thanks

Origin Ver.2018b
Operating System:Windows10
3   L A T E S T    R E P L I E S    (Newest First)
yuki_wu Posted - 10/22/2019 : 03:35:31 AM
Hi,

You can call X-Function wreducerows to reduce missing value:
https://www.originlab.com/doc/X-Function/ref/wreducerows

Regards, Yuki

OriginLab
karvek Posted - 10/18/2019 : 08:32:40 AM
Hi Yuki,

that works beautiful.

Now assume I would like to create a column that is formed by a certain range (like r1) and another range that is a single value of colB repeated a fixed number of times.

I am trying to use
r2 = cell(11,2);
range r3 = C;
for (i=1; i<10; i++)
{copy -a r2 r3;};

but it does not really work.
Looking forward for your suggestion!

EDIT: I solved it using the repeat function, the problem is the way Origin is handling the "empty" (NAN) cells and this conflicts with range. I was unable to find a command to fully delete this NAN values so I had to do this manually, but now it works.
yuki_wu Posted - 10/17/2019 : 10:21:48 PM
Hi,

You can use copy command:
range r1 = A[1:10];
range r2 = B[11:20];
range r3 = C;
r3 = r1;
copy -a r2 r3;

Copy Command: https://www.originlab.com/doc/LabTalk/ref/Copy-cmd#-a.3BAppend_contents_of_dataset1_to_the_end_of_dataset2.

Regards, Yuki
OriginLab

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