Find number in vector
Afficher commentaires plus anciens
Let’s say I have this vector: A = [1,2,3,4,5,6] and I want to know when did my vector went above 3. Like I want to know the value that made my vector go above 3. So I’m interested in the value “4” not 5 or 6. Is there is a code that can help me ?
Réponse acceptée
Plus de réponses (1)
Try this:
A = [1,2,3,40,50,60];
index = find(A > 3, 1, 'first')
theValueThere = A(index)
Catégories
En savoir plus sur Matrix Indexing 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!