How to count numbers greater than a determined value

4 views (last 30 days)
Need help structuring how I would tell MATLAB to count the number of values in a structure greater than a pre determined amount. For example:
I have a vector of data that holds heights ranging from 0 to 100 and I want to count how many are above a threshold above 0.5, then 0.6, then 0.7.... all the way to 100, which would be zero.

Accepted Answer

Matt J
Matt J on 20 May 2022
Edited: Matt J on 20 May 2022
out = cumsum( histcounts(heights,0.5:0.1:100-eps(100)) ,'reverse');

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!