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
 Copy rows...

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
Ana-Maria Posted - 05/24/2010 : 3:43:19 PM
Hello,
I am trying to write a labtalk to copy all rows of the original worksheet to a new worksheet. From row 1 to last row, but row 1, 2, 3, … last, should be repeated a number of times (30 times for example) in the new worksheet (same number of repetition for all the rows). I only have 3 columns, but a big number of rows.

I am using Origin Version 7.5 and Windows Vista.
Thanks,
Ana.


4   L A T E S T    R E P L I E S    (Newest First)
Ana-Maria Posted - 05/25/2010 : 11:51:49 PM
Penn,
It is exactly what I was trying to do...
Thanks a lot Penn! :-)

Sincerely,
Ana.
Penn Posted - 05/25/2010 : 10:14:40 PM
Hi Ana,

Sorry for misunderstanding your requirement. However, the copy can still be used to solve your problem. Please try the following script.

set data2 -er 30*(data1!wks.maxrows);  // set row size of Data2 worksheet
for(jj=1; jj<=data1!wks.maxrows; jj++)
{
	for(ii=(jj-1)*30+1; ii<=30*jj; ii++)
	{
		// use -b and -e options to copy only one cell
		copy -b jj data1_a data2_a -b ii -e ii;
		copy -b jj data1_b data2_b -b ii -e ii;
		copy -b jj data1_c data2_c -b ii -e ii;
	}
}


Penn
Ana-Maria Posted - 05/25/2010 : 7:22:56 PM
Hi Penn! Thanks!
I was using copy already, but I can not do what I need… If I have:
1 1 1
2 2 2
3 3 3
I would like to repeat a number of times as I explain before, but I need them to be like this:
1 1 1
1 1 1
2 2 2
2 2 2
3 3 3
3 3 3
This is what I am not able to do…

Penn Posted - 05/25/2010 : 01:27:25 AM
Hi Ana,

You can use the copy command. Please try the following script:

// suppose the name of original worksheet is Data1,
// name of the new worksheet is Data2.
// 3 columns are column A, B and C.
for(ii=1; ii<=30; ii++)
{
	copy -a Data1_A Data2_A;
	copy -a Data1_B Data2_B;
	copy -a Data1_C Data2_C;
}


Penn

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