Help with Matrix logic and indexing
이전 댓글 표시
how do i look through a matrix and count how many times this conditon occuers ( >= 40 & <= 50)
답변 (2개)
Image Analyst
2022년 3월 27일
Use sum():
mask = m >= 40 & m <= 50; % Works for vectors or matrices where m is your array.
count = sum(mask(:))
댓글 수: 2
Trying to Try
2022년 3월 27일
Image Analyst
2022년 3월 27일
Can you then click the "Accept this answer" link? Thanks in advance. 🙂
Stephen23
2022년 3월 27일
cnt = nnz(m>= 40 & m<= 50)
카테고리
도움말 센터 및 File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!