How to remove multiple elements from an array?
19 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have an array x which is equal to [1:50].
I am trying to remove all the elements that are divisible by 3, 4, and 5.
I cannot figure this out for the life of me, I'm sure it will involve some sort of For Loop and three different mod functions.
I would greatly appreciate help from anyone!
0 commentaires
Réponse acceptée
Azzi Abdelmalek
le 19 Sep 2013
Modifié(e) : Azzi Abdelmalek
le 19 Sep 2013
a=1:50
a(~mod(a,3)|~mod(a,4)|~mod(a,5))=[]
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Matrix Indexing 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!