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
 Copying multiple columns using range variables

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
Criterion Posted - 03/16/2014 : 12:10:09 PM
Origin Ver. and Service Release (Select Help-->About Origin): 9.1.0G Sr1
Operating System: Win7 64bit

Hi,

I've used range variables to copy data from one column to another column before. This works perfectly. As ranges can be used to hold multiple columns at a time I thought that it might be possible to copy multiple columns using a range variable as in the following example:


range aa = [book1]sheet1!(1:5);
range bb = [book1]sheet2!(1:5);
bb = aa;


Unfortunately this will only put the first column of range aa into the first column of range bb. No matter how I try to alter the syntax this doesn't seem to work. I know that I can use the colcopy command to do what I want but this behaviour seems counterintuitive to me.

with kind regards Criterion
2   L A T E S T    R E P L I E S    (Newest First)
Criterion Posted - 03/17/2014 : 08:20:06 AM
Hi Kathy,

thank you for your help. Your example works.

Regards Criterion
Kathy_Wang Posted - 03/17/2014 : 06:41:39 AM
Hi,

You may use the range -v method to define a block of cells as one range and store all values in a temp vector. So the script can be rewritten as:


//Suppose you have 11 rows of your data
range -v aa = [Book1]Sheet1!1[1]:5[11];
//Note that you need to make sure there are enough destination columns
//Need 5 columns in Sheet2 otherwise the data will not be completely copied
range -v bb = [Book1]Sheet2!1[1]:5[11];
bb = aa;


Kathy
Originlab

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