Clear Filters
Clear Filters

Finding frequency of values above a certain value in a matrix

2 views (last 30 days)
I have a 301X301 matrix (M). How do I find number of cells above a certain value?
Thanks in advance.

Accepted Answer

Ameer Hamza
Ameer Hamza on 12 Oct 2020
Edited: Ameer Hamza on 12 Oct 2020
Use nnz(): https://www.mathworks.com/help/matlab/ref/nnz.html with the logical matrix
thresh; % threshold value
n = nnz(M > thresh) % number of element over 'thresh' value

More Answers (0)

Categories

Find more on Linear Algebra in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!