how do i look through a matrix and count how many times this conditon occuers ( >= 40 & <= 50)

Antworten (2)

Image Analyst
Image Analyst am 27 Mär. 2022

1 Stimme

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

2 Kommentare

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

Melden Sie sich an, um zu kommentieren.

Kategorien

Gefragt:

am 27 Mär. 2022

Beantwortet:

am 27 Mär. 2022

Community Treasure Hunt

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

Start Hunting!

Translated by