operation in matrix in matlab
Mostrar comentarios más antiguos
if i want to know the number of times an condition is fullfilled for a matrix, how can i do so;
a=[3 4 2 5 3 5]; %defining a matrix
% now what should i write if i want to know the number of times, a matrix
% has a value greater than 4.
Respuesta aceptada
Más respuestas (1)
"...i want to know the number of times, a matrix has a value greater than 4."
The efficient MATLAB approach:
a = [3,4,2,5,3,5];
nnz(a>4)
Categorías
Más información sobre Mathematics 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!