operation in matrix in matlab
Afficher commentaires plus anciens
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.
Réponse acceptée
Plus de réponses (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)
Catégories
En savoir plus sur Mathematics dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!