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
 Delete empty rows at the end of a wks
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

LarsVSA6

Germany
3 Posts

Posted - 10/07/2003 :  02:22:31 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello,

can i delete empty rows at the end of a wks by a script, as i can do by hand? (At least down to the 30 rows of the standard value)

I try to use the mark -d Mywks_B (or every other column) -b firstemptyrow -e endofwks command, but this does not work for empty rows.

I want to use this, because i have a wks-file with for example 17 measurements, each measurement with different numbers of rows and in the sum up to 1500 rows. I want for every measurement a single wks. Until now, i do it by a script in the way like this:

first step: duplicate the original wks and change the name to the first measurement

second step: delete all rows behind the first measurement contains data with the mark command in the duplicated wks

third step: delete all rows of the first measurement in the original wks

and so on...

Before i start to duplicate with the first step there is a loop through the original wks to find out the number of rows for every measurement.

The result at the end is, that i have 17 wks but all with the same numbers of rows as the original one, and of cause the most of them are empty. Also they are empty ones, they cost a lot of diskspace and the *.opj-file increase in size, and for further calculating of the data in the worksheet it cost much more time.

Thank you for an answer,

Lars.

Mike Buess

USA
3037 Posts

Posted - 10/07/2003 :  07:40:17 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Lars,

This will set the number of rows in Data1 to nRows...

set Data1 -er nRows;

Mike Buess
Origin WebRing Member
Go to Top of Page

St-Ranger

USA
17 Posts

Posted - 11/10/2003 :  12:37:43 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:

Hi Lars,

This will set the number of rows in Data1 to nRows...

set Data1 -er nRows;

Mike Buess



This works on a large wks, but doesn't seem to work on small worksheets (I just tried to do it on a 20 raw wks, to cut it down to 7), at least in Origin 6.0 SR4.
I wonder, is it because of a minimum size of a wks, or why?

Thanks.


Edited by - St-Ranger on 11/10/2003 12:44:26 PM
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 11/10/2003 :  2:12:20 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
It's just a matter of the wks window size. Empty space is not allowed at the bottom of the wks window, so if 20 rows will fit in the window you'll get at least 20 rows. If you shrink the window such that only two rows are visible you can reduce the number of rows to 2. But stretching the window will create rows to fit.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 11/10/2003 2:13:07 PM
Go to Top of Page

St-Ranger

USA
17 Posts

Posted - 01/03/2004 :  7:59:25 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply

I just realized that I also need to clean multiple worksheets in several Origin projects from empty rows. So, I wrote a script that maybe will be useful to somebody with similar needs (as Lars was).
This script cuts off all zero rows. It does not seem to remove empty lines in the middle of the datasets, although I did not do a thorough testing.

doc -e W {
nRows=%H!wks.maxRows;
set %H -er $(nRows);
};



In case you might have an empty worksheet, the following modified script will not break on such a worksheet and will inform you about the name of that empty window, but will not do anything to it.


doc -e W {
nRows=%H!wks.maxRows;
if (nRows > 0) {
set %H -er $(nRows);
};
else {
type (%H worksheet is empty);
};
};


For me, a few projects became 2-3 times smaller.

PS.
Mike, thanks for your earlier response. I just didn't want to waste the traffic for a separate "thank you" note.

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