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
 Remove points

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
Mats77sv Posted - 05/11/2015 : 4:45:43 PM
Origin Ver. and Service Release (Select Help-->About Origin): 9.1pro
Operating System:win7

Hi,

In columns A and B I have a more than 200000 recorded data points and from time to time I get a sequence of identical data values. If I get a sequence of 6 or more similar data values, then I want to remove all point in the sequence except of one! So fare I have used a piece of a script that almost work - but not quite good enough as it also remove a few additional data points just before the "bad" sequence starts (see script below):


range raTarget = col(A), raTest = col(A);
count = 0;
flag = 0;
loop(ii,1,raTarget.GetSize())
{
switch(flag)
{
case 0:
if(raTarget[ii+1] >= raTest[ii]) count++;
else count = 0;
if(count == 6) flag = 1;
break;
case 1:
if(raTarget[ii+1] >= raTest[ii]) count++;
else
{
loop(idx,ii-count,ii-1)
{
raTarget[idx] = 0/0;
}
count = 0;
flag = 0;
}}}
range raTarget = col(B), raTest = col(B);
count = 0;
flag = 0;
loop(ii,1,raTarget.GetSize())
{
switch(flag}
{
case 0:
if(raTarget[ii+1] >= raTest[ii]) count++;
else count = 0;
if(count == 6) flag = 1;
break;
case 1:
if(raTarget[ii+1] >= raTest[ii]) count++;
else
{
loop(idx,ii-count,ii-1)
{
raTarget[idx] = 0/0;
}
count = 0;
flag = 0;
}}}

I also have a column C only listed with "1". If I could 'flag' the sequence of bad points by changing the related row values in column C to "0", then I could easily remove the points. But how do I get so far?

/Mats
4   L A T E S T    R E P L I E S    (Newest First)
Mats77sv Posted - 05/18/2015 : 5:49:39 PM
Hi Zheng,

I will sent some data to play with - thanks again.

\Mats
lkb0221 Posted - 05/18/2015 : 11:48:25 AM
Hi, Mats

I think it will be better if you can share a piece of data so we can play with it. You can send to <tech@originlab.com>.


Zheng
OriginLab
Mats77sv Posted - 05/14/2015 : 6:23:48 PM
Hi Jacqueline,

Thanks for trying to help me and sory for my late answer. However, your suggestion will not work for me - sorry. Actually, I have 14 columns and more than 200000 data lines. My problem with the sequence of similar data values is only found in two columns – let’s call then A and B. If I delete the data values as suggested and shift up the data I will lose the connection to all the other columns.
So fare I have tried using the script I showed previously and then used the "csetvalue" command to delete the entire data line - not shifting up the row. However, the script, as it is now, also deletes the two data values found just before the start of the sequence of trouble data. That I do not know how to fix.
So basically I am trying to make a script that deletes a sequence of 6 similar values in a specific column. The 6 data values must appear right after each other otherwise they should not be deleted.
I really really hope you can help med :-)

\Mats

JacquelineHe Posted - 05/12/2015 : 04:48:07 AM
Hi Mats,

1. Maybe because the following loop script in Case 1, so a few data will become missing value when you run your script.

loop(idx,ii-count,ii-1)
{
raTarget[idx] = 0/0;
}


2. If I do not misunderstand your meaning, you want to store the "flat" value for each loop, you can use:
Col(C)[ii]=flag;


Then use the loop script to delete the data if the corresponding "flat" value=0. For example:

range raTarget = col(A);
loop(ii,1,raTarget.GetSize())
{
range aa=1[$(ii)];
double bb=col(3)[$(ii)];
if (bb==0) del aa;
}

Please note: This script just delete the data in Column A (Column1), and shift cells up. So after run it the corresponding relation of Column A data and the Column C "flat" will be broken.

Thanks
Jacqueline
Originlab

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