Functios in MatLab for matrixes
Mostrar comentarios más antiguos
Is there a function that, once introduced any matrix, counts how many 0's there are, how many elements between 0 and 1, and how many are bigger than 1 in said matrix? Thanks!
Respuesta aceptada
Más respuestas (1)
You can do
nnz(A>1)
or
sum(A(:)>1)
and similarly for other logical conditions. In some cases, nnz will be the fastest option for sparse matrices. Otherwise, sum() is usually the fastest.
Categorías
Más información sobre Sparse 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!