remove index

17 vues (au cours des 30 derniers jours)
huda nawaf
huda nawaf le 28 Avr 2012
hi,
how I can remove index 3,6,9,....?
ex.
x=[10 2 3 5 15 7 8 100 2 10 12 23 20];
i need x be
x=[10 2 5 15 8 100 10 12 20];
I do not want use loop
thanks in advance

Réponse acceptée

Wayne King
Wayne King le 28 Avr 2012
x = [10 2 3 5 15 7 8 100 2 10 12 23 20];
x(3:3:end) = [];
  1 commentaire
Andrei Bobrov
Andrei Bobrov le 28 Avr 2012
x(nonzeros((1:numel(x)).*(rem(1:numel(x),3)~=0)))

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by