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
 How to remove data 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 - 08/29/2014 : 5:04:37 PM
Origin Ver. and Service Release (Select Help-->About Origin): 9.1
Operating System:win7

Hi,

I am looking for a way to remove data points but only if certain requirements are satisfied. If data points in col(3) take the value of col(3)>=col(2)*0.9 then data points should be deleted if the next 4 data points have similar values. I have tried with:

csetvalue col:=col(3) formular:=”col(3) >= col(2)*0.9 ? 1/0 : col(3)” recalculate:=0;
csetvalue col:=col(3) formular:=”col(2)==NANUM?--:col(3)” recalculate:=0;

But how do I make it work only on data points where col(3)>=col(2)*0.9 in 4 rows right after each other? Is it even possible in Origin?
4   L A T E S T    R E P L I E S    (Newest First)
Mats77sv Posted - 09/07/2014 : 5:11:14 PM
Hi Greg,

Sorry for my late response. Yes your coding now Works perfect in my script. Thanks.
greg Posted - 09/03/2014 : 09:35:52 AM
// BEGIN SCRIPT
range raTarget = col(3), raTest = col(2);
count = 0; // Keep track of how many failed points
flag = 0; // Set to one when four sequence minimum is met
loop(ii,1,raTarget.GetSize())
{
switch(flag)
{
case 0:
if(raTarget[ii] >= raTest[ii] * 0.9) count++;
else count = 0;
if(count == 4) flag = 1;
break;
case 1:
if(raTarget[ii] >= raTest[ii] * 0.9) count++;
else
{
loop(idx,ii-count,ii-1)
{
raTarget[idx] = 0/0;
}
count = 0;
flag = 0;
}
}
}
// END SCRIPT
Mats77sv Posted - 09/02/2014 : 4:23:45 PM
Hi Kathy,

Thank you for your quick reply.

Not a bad idea with the extra column, however it only solves part of my issue. Imagine you have col(4) with 7 "1" right after each other and then followed by only "0's". Once you step down the rows with

csetvalue col:=col(3) formula:="col(4)[i+1]+col(4)[i+2]+col(4)[i+3]+col(4)[i+4]==4?1/0:col(3)" recalculate:=0;

only the first few points will be removed as you eventually will start to sum over some "0". I want to remove all 7 points. If only there were ex. 3 "1" appearing right after each other, then none of them should be removed. It's a bit tricky and I am not sure how to solve it.
Kathy_Wang Posted - 09/01/2014 : 05:24:22 AM
Hi,

An approach I could think of is to add a 4th column as reference and define it as col(3) >= col(2)*0.9 ? 1 : 0 so it fills with 1 or 0, and then you can sum up the reference values for the next 4 data points and if the value is 4, then this data point should be removed, and otherwise, it should be kept.

An example would be:


csetvalue col:=col(4) formula:="col(3) >= col(2)*0.9 ? 1 : 0" recalculate:=0;
csetvalue col:=col(3) formula:="col(4)[i+1]+col(4)[i+2]+col(4)[i+3]+col(4)[i+4]==4?1/0:col(3)" recalculate:=0;


And you may need to change the condition a bit according to your specific need (i.e does the 4 points include the data point itself.etc)



Kathy
Originlab

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