Using if condition store values in an array
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Waqas Siddique
le 19 Fév 2021
Modifié(e) : Walter Roberson
le 20 Fév 2021
I have a list of numbers stored as double type in a variable B. I want to use if condition so that if the value of element in B is greater than or equal to 12, I want to store all those values in another array named C.
1 commentaire
Réponse acceptée
the cyclist
le 19 Fév 2021
If I understand you correctly, this does what you want. (It doesn't directly use "if", but does the job via logical indexing instead.)
C = B(B>=12);
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Operators and Elementary Operations 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!