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
 Finding a threshold value

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
tib Posted - 01/18/2002 : 08:32:34 AM

I have a y-dataset which is increasing (or decreasing) with x.
Now, I want to display the data only starting from when the y-value is above a certain noise level.

The functions xindex(x,dataset) and xindex1(x,dataset) are not helpful for this task since they give me only a x-threshold. The list(value,dataset) function would be ideal, unfortunately it makes an exact comparison, so it's useless for my purpose.

Futhermore, I want to display the data of a y1-column beginning from when the value of a y2 column (they have the same x-column) is above a certain threshold.

The only way I found is to scan the columns "manually".

THR=4e-11; // threshold value;
NRW=data1!wks.maxRows; // number of rows;
loop (ii,1,NRW) {
if (data1_b[ii]>THR) {IDX=ii; break;};
};
type "The row index where the value is above $(THR) is $(ii)";

Maybe anybody knows about a better and probably faster method?
Isn't there any function like yindex(y,ydataset)?

An other question concerning xindex1(x,dataset): when I fill x columns data1_a with 1,2,3,4... and data1_b with any values and I perform the command xindex1(0,data1_b) I get back 2. But shouldn't it be 1?
3   L A T E S T    R E P L I E S    (Newest First)
Mike Buess Posted - 01/23/2002 : 09:57:09 AM
Hi Tilman,

Actually, there is a built-in Origin function called "tReplace" that seems suited for this sort of thing. I have never used it, but according to its help file description it should work for you. Search for it in LabTalk help.

Note: This function was introduced in Patch 2 for Origin 6.1 and more documentation is available in the release notes. Those notes say that it is much faster than the ternary operator method that I suggested.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 01/23/2002 13:59:19
tib Posted - 01/23/2002 : 05:06:06 AM
Mike, this structure is really good!
Both functions are in the manual. But I would like to see more of such combinations as examples there. I thought that finding thresholds and limits are daily tasks that there even should be a single function for it.

1. search for the first number: value > THR
TMP=(Data1_B>THR)?1:0;
LOW=list(1,TMP);
a) the first number > THR is at row index 50
b) all numbers > THR
c) no number > THR
The results of your formula are:
1a) LOW=50
1b) LOW=1
1c) LOW=0
All these results are OK.
With this, I could limit a dataset by set Data1_B -b LOW;

But!

2. search for the last number: value < THR
TMP=(Data1_B < THR)?1:0;
HIG=list(0,TMP);
a) the last number < THR is at row index 50
b) all numbers < THR
c) no number < THR
The results of your formula are:
2a) HIG=51 50 would be right
2b) HIG=0 last index of last row would be nice
2c) HIG=1 0 would be nice;

I want to set the end range of the dataset by set Data1_B -e HIG;

In that case a have to add a sequence:
HIG-=1; // subtract 1;
if (HIG==-1) {get Data1_B -e AAA; HIG=AAA};

That should work. But maybe you also have a better solution for that?
Thanks a lot! Tilman.

By the way, do you know if there is a command for resetting the dataset to full range?
AAA=Data1!wks.maxRows; set Data1_B -e AAA;
Mike Buess Posted - 01/18/2002 : 12:52:41 PM
This may be a little better...

tmp=(data1_b>THR)?1:0;
ii=list(1,tmp); del tmp;
type "The row index where the value is above $(THR) is $(ii)";

The list() function works here because the values in tmp are exactly 0 and 1.

Mike Buess
Origin WebRing Member

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