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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Copying multiple columns using range variables
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Criterion

2 Posts

Posted - 03/16/2014 :  12:10:09 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

Kathy_Wang

China
159 Posts

Posted - 03/17/2014 :  06:41:39 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

Criterion

2 Posts

Posted - 03/17/2014 :  08:20:06 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Kathy,

thank you for your help. Your example works.

Regards Criterion
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000