How to count in arrays?
Afficher commentaires plus anciens
Let's say I have two arrays
apple = [1 2 3 4 5 6 7 8];
pear = [2 3 1 2 7 6 1 8];
I want to compare these arrays and count how many items in pear are bigger than the item at the same place in apple. How would I do this?
1 commentaire
the cyclist
le 17 Nov 2014
Modifié(e) : the cyclist
le 17 Nov 2014
Sounds like homework. Here are a few hints:
- There is "greater than" operator in MATLAB, which will operate on vectors
- There is also an operator that will sum over a vector
- There is a docsearch command that will search the documentation
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Logical 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!