Indexing through an array
14 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Suppose I have this
B = [1 4 7 10; 2 5 8 11;3 6 9 12]
1 4 7 10
2 5 8 11
3 6 9 12
And I want to check through each column for a value of 2. How would I do this?
1 commentaire
James Tursa
le 3 Mar 2021
What do you want as a result? A logical array indicating which columns have a 2 in them? An outline for a for-loop that checks for a 2 in a column? Or ...?
Réponses (1)
Voir également
Catégories
En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!