MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by Hamza
on 6 Jan 2013

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.

*No products are associated with this question.*

Answer by Azzi Abdelmalek
on 6 Jan 2013

Edited by Azzi Abdelmalek
on 6 Jan 2013

Accepted answer

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)

Hamza
on 6 Jan 2013

Thanks, but "find" only gives the indices and I want to have the values >0.05

Answer by Image Analyst
on 6 Jan 2013

Edited by Image Analyst
on 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);

## 0 Comments