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
 SOLVED - Filter seems to skip 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

whylabtalkwhy

Germany
2 Posts

Posted - 03/17/2016 :  09:11:00 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release: Origin 9.1.0 (64-bit) b215 (Home Use)
Operating System: Windows 8.1

Hi,

I am running a fairly simple program to filter out all data points greater than a certain x-Value from a worksheet with only two columns (X and Y, about 5000 rows). However, if I run the program one time, Origin seems to skip about 10 data points. If I run it a second time, those points disappear as well. I would like it to filter everything out on th first run.

Here is my program:

xm = 20000;

get col(A) -e numpoints;
for(ii = 1 ; ii <= numpoints ; ii++)
{ range xx = col(A)[ii];
if(xm-Col(A)[ii]<=0){
mark -d xx;
}
}

I would appreciate your help.
Cheers,
whylabtalkwhy

Edited by - whylabtalkwhy on 03/17/2016 09:49:25 AM

whylabtalkwhy

Germany
2 Posts

Posted - 03/17/2016 :  09:48:20 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Found the solution myself but just in case anybody has the same question in the future.

Deleting a row sets the index of the for loop off, so you need to reset it to the one before and insert ii=ii-1.
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