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
 Find the mistake

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
sbaruah Posted - 11/16/2005 : 05:56:50 AM
Origin Version (Select Help-->About Origin): 7
Operating System: win xp

Hi,
I am just in the learner's state. Can you tell me the mistake in the following?

I want to delete such rows from a worksheet which contain the number 2 in a particular column (say C).
Here it goes:

getnumber
(total row number) rownum;
// total row number in the main worksheet

work -d maindata;
// duplicate the worksheet and call it maindata

window -a maindata;
// set the window maindata as the active window

for(i2=1; i2<=rownum; i2=i2+1)
{
if(maindata_C[i2]==2)
{
work -s 1 $(i2) 5 $(i2);
Menu -e 36442;
//delete the whole row
}
}
2   L A T E S T    R E P L I E S    (Newest First)
sbaruah Posted - 11/16/2005 : 10:57:27 AM
Hi,
Thanks for your suggestion. It works nicely.
Regards.
Mike Buess Posted - 11/16/2005 : 08:08:59 AM
Deleting a row renumbers all subsequent rows so it's better to start from the bottom and search up. This variation also uses the mark command to delete the row...

work -d maindata;
get maindata_C -e rownum; // number of rows
for(i2=rownum; i2>0; i2--)
{
if(maindata_C[i2]==2)
mark -d maindata_C -b i2 -e i2;
};

However, the following method will be much faster because it does not have to examine every row. It uses the list() function to find the next occurrence of the specified value.

work -d maindata;
for(i2=1;i2>0;i2++) {
ii=list(2,maindata_C);
if(ii==0) break;
mark -d maindata_C -b ii -e ii;
};

Mike Buess
Origin WebRing Member

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