Help with Matrix logic and indexing
1 view (last 30 days)
Show older comments
how do i look through a matrix and count how many times this conditon occuers ( >= 40 & <= 50)
0 Comments
Answers (2)
Image Analyst
on 27 Mar 2022
Use sum():
mask = m >= 40 & m <= 50; % Works for vectors or matrices where m is your array.
count = sum(mask(:))
2 Comments
Image Analyst
on 27 Mar 2022
Can you then click the "Accept this answer" link? Thanks in advance. 🙂
See Also
Categories
Find more on Resizing and Reshaping Matrices 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!