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
 Loop stops after the first 30 values
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

cougar2

Germany
Posts

Posted - 01/30/2004 :  08:33:23 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi everyone,

Im using Origin 7 to process a number of worksheets named A115021Nr0334 to A115021Nr0402 (i.e. 70 or more).
My labtalk script is supposed to just copy the value of cell No. 124 in column C to another existing worksheet named data1. However this loop always stops after the 30th cell and the same happens when taking a for loop:

loop (num, 334, 402) {
copy -b 124 A115021Nr0$(num)_C data1_D -b $(num-333) -e $(num-333);
};

Until cell No. 30 it works well (and No. 30 or 31 do exist).
Can anybody help?

Mike Buess

USA
3037 Posts

Posted - 01/30/2004 :  09:27:56 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
It probably stops because data1 has only 30 rows (default # for new worksheets). Also, there are easier ways to copy cells...

set data1 -er 402; // make sure that data1 has enough rows
loop (num,334,402 ) {
data1_D[num-333]=A115021Nr0$(num)_C[124];
}

Mike Buess
Origin WebRing Member
Go to Top of Page

cougar2

Germany
Posts

Posted - 01/30/2004 :  10:37:44 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks a lot Mike, it works fine now.
Please let me ask another question which connects to the first problem. Can I instead of just copying the values into one column in data1 also copy them into separate columns (23 of them each into one column and then jump to the next in data1 and copy the next 23 and so on)?

Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 01/30/2004 :  12:43:55 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
There are a number of ways to do that. This method assumes you use the default column names...

col number: 1 2 3 4 5 ...
col name: A B C D E ...

Columns are created in data1 as they are needed.
%P=A115021Nr0;
%W=data1;
if( exist(%W_D)==1 ) del %W_D; // delete data1 col(D) if it exists
m=3; // initialize data1 col #
n=1; // initialize data1 row #
loop (num,334,402) {
if( mod(num-334,23)==0 ) {
%W!wks.addCol(); // create col
m++; // increment col #
n=1; // reset row #
};
%W!cell(n,m)=%P$(num)_C[124];
n++; // increment row #
};


Mike Buess
Origin WebRing Member
Go to Top of Page

cougar2

Germany
Posts

Posted - 02/02/2004 :  07:45:49 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Mike, it works perfectly, thanks again so much.

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