How to filter out values which are greater than a defined threshold?

48 Ansichten (letzte 30 Tage)
Dear all
I would like to ask how I can filter out the values in a given dataset. For eg: I have the following data:
max= 0.0390719994902611
0.0769229978322983
0.0561660006642342
0.0695969983935356
0.0720390006899834
0.0463979989290237
0.0317460000514984
0.0293039996176958
0.0317460000514984
0.0280830003321171
0.0378509983420372
I want to see how many values have exceed the threshold of 0.05 in this. Thanks for the help.

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 6 Jan. 2013
Bearbeitet: Azzi Abdelmalek am 6 Jan. 2013
max_value= [0.0390719994902611
0.0769229978322983
0.0561660006642342
0.0695969983935356
0.0720390006899834
0.0463979989290237
0.0317460000514984
0.0293039996176958
0.0317460000514984
0.0280830003321171
0.0378509983420372]
idx=find(max_value>=0.05)
%don't max as a variable(reserved to max function)
  3 Kommentare
Azzi Abdelmalek
Azzi Abdelmalek am 6 Jan. 2013
Bearbeitet: Azzi Abdelmalek am 6 Jan. 2013
idx=find(max_value>=0.05)
value=max_value(idx)
Jan
Jan am 6 Jan. 2013
As MLint mentions in the editor, when you type this in a function, the find() is slower than a logical indexing in almost all cases:
value = max_value(max_value >= 0.05);

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Image Analyst
Image Analyst am 6 Jan. 2013
Bearbeitet: Image Analyst am 6 Jan. 2013
To see "how many values have exceed the threshold of 0.05" you can use this code:
howManyValues = sum(max_value>0.05);

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by