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
 Origin Forum
 LabTalk: copy -b: Not more than 30 rows?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Ralph Stuebner

Munich, Bavaria, Ger
9 Posts

Posted - 04/18/2000 :  12:43:00 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello,

i have written a script, which copies every nth row of a worksheet into a new worksheet to get rid of unnecessary data. It works very well until not the 31th row in the new worksheet is reached. I use the command:

copy -b N Data1_A Data2_A -b i -e i

N, i: numbers form 1 to ....

If i is smaller than 30 the command works very well, if i is 31 or bigger, it produces a command error, although more than 40 rows exist in Data2. What can I do?

Thanks Ralph

------------------

HelgeSteen

NORWAY
4 Posts

Posted - 04/20/2000 :  8:57:00 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The number 30 is the default number of rows showing up when I start my Origin 5.0 so I wonder if there is a problem here.

I have seen a problem running Worksheet scripts assigning new data to empty cells where there is no data non of the columns. I have solved this by assigning %H_B = % H_A/0; which does not gives any data except for the - showing non-valid data. In the example above be sure that column A has data for all rows. (%H contains the Name of the current Worksheet window)

I hope this can help until we hopefully get a response from tech support that can explain the behaviour.

Helge

Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 04/26/2000 :  1:23:00 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Use the 'get' command to find out how many rows are in a column and the 'set' command to add new rows to a worksheet. If Data1 has two filled columns and Data2 has two empty columns, then the following script will copy only the even-numbered rows in Data1 to Data2 no matter how many rows were in either worksheet to begin with.

get Data1_A -e nn1; // nn1=number of rows in Data1
for(i=1;i>0;i++) {
N=2*i; if(N>nn1) break; // stop if we've exhausted Data1
get Data2_A -e nn2; // nn2=number of rows already in Data2_A
set Data2 -er nn2+1; // add a row to Data2
copy -b N Data1_A Data2_A -b i -e i;
copy -b N Data1_B Data2_B -b i -e i;
};

I prefer the simpler expression Data2_A[i]=Data1_A[N] for copying values one at a time, but that's probably just a matter of taste.

-Mike

Go to Top of Page

Laurie

USA
404 Posts

Posted - 04/26/2000 :  3:06:00 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Yes, 30 rows is a default number used by Origin. As HelgeSteen says, when you click the 'New Worksheet' button on the Standard Toolbar, an Origin worksheet opens with 30 rows.

As Mike says, you need to use the get and set commands. When columns in a worksheet are not filled with data, the get datasetName -e end command will set the variable, end, to 0. By using the set datasetName -e 50 command, you will fill the dataset with 50 rows of missing values. (You can think of this as 50 placeholders.) This is also what HelgeSteen does when he uses the notation, %H_B = % H_A/0;

In other words, you want to first set the number of rows available before copying data into the column. And you do this with the set command.

For example:

If you wanted to copy rows 10-50 of data1_a to data2_a, then you would use the following script:

set data2_a -e 41;
copy -b 10 data1_a data2_a -b 1 -e 41;

-----------------
Laurie A. Shea
Microcal Technical Support

Go to Top of Page

Ralph Stuebner

Munich, Bavaria, Ger
9 Posts

Posted - 04/26/2000 :  8:39:00 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

it seems that the problem is more sophisticated.
The copy -b works in 31st row when this row exists and is manually created by insert. In the script I wrote a worksheet is created by

window -n wks %L;
window -a %L;
worksheet -a c;

(%L worksheet name). This worksheet initially contains 40 rows. When copy -b is executed now on row number 31 it fails.
So, is there a way to insert a number of rows into a worksheet by Lab Talk?
Maybe this helps.

Thanks Ralph

------------------

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