Multidimensional Array indexing to a single vector
Afficher commentaires plus anciens
I want to check to see if a portion of each column of my array meets a criteria and if it does give a value of 1 and if it doesn't, 0. So x=B(1:5,:)>10 and if B is a 10X10 array, I would like to have x be a 1X10 column vector of ones or zeros. I know this can be done with a loop, but is there anyway to do it without one?
Réponse acceptée
Plus de réponses (1)
Honglei Chen
le 21 Juin 2012
0 votes
sum(B(1:5,:)>10)>0
1 commentaire
Walter Roberson
le 21 Juin 2012
This would be equivalent to the any() code.
Catégories
En savoir plus sur Matrices and Arrays dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!