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
Image Analyst 2022년 3월 27일

1 개 추천

Use sum():
mask = m >= 40 & m <= 50; % Works for vectors or matrices where m is your array.
count = sum(mask(:))

댓글 수: 2

Trying to Try
Trying to Try 2022년 3월 27일
Thank you so much ive wasted to much of my day on this one
Image Analyst
Image Analyst 2022년 3월 27일
Can you then click the "Accept this answer" link? Thanks in advance. 🙂

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

질문:

2022년 3월 27일

답변:

2022년 3월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by