Borrar filtros
Borrar filtros

How to remove multiple elements from an array?

19 visualizaciones (últimos 30 días)
Steven
Steven el 18 de Sept. de 2013
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!

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 19 de Sept. de 2013
Editada: Azzi Abdelmalek el 19 de Sept. de 2013
a=1:50
a(~mod(a,3)|~mod(a,4)|~mod(a,5))=[]
  1 comentario
Steven
Steven el 19 de Sept. de 2013
Thank you so much for your help. I really appreciate it!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by