Help with Matrix logic and indexing
Mostrar comentarios más antiguos
how do i look through a matrix and count how many times this conditon occuers ( >= 40 & <= 50)
Respuestas (2)
Image Analyst
el 27 de Mzo. de 2022
Use sum():
mask = m >= 40 & m <= 50; % Works for vectors or matrices where m is your array.
count = sum(mask(:))
2 comentarios
Trying to Try
el 27 de Mzo. de 2022
Image Analyst
el 27 de Mzo. de 2022
Can you then click the "Accept this answer" link? Thanks in advance. 🙂
Stephen23
el 27 de Mzo. de 2022
cnt = nnz(m>= 40 & m<= 50)
Categorías
Más información sobre Resizing and Reshaping Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!