How can i delete certain numbers of an array

1 vue (au cours des 30 derniers jours)
marios semer
marios semer le 10 Déc 2020
Commenté : marios semer le 10 Déc 2020
Hi, i have and array with numbers [ 0 , pi ] and i want to delete all the samples from 0.4*pi to 0.5*pi to have one array with numbers between [0,0.4*pi] and [0.5*pi , 0] .
How can i do it ?
w = linspace(0 , pi , 260);

Réponses (2)

Ameer Hamza
Ameer Hamza le 10 Déc 2020
You can use logical indexing
w = linspace(0 , pi , 260);
idx = (w > 0.4*pi) & (w < 0.5*pi);
w(idx) = []
  1 commentaire
marios semer
marios semer le 10 Déc 2020
Thank you very much. This helped a lot.

Connectez-vous pour commenter.


Star Strider
Star Strider le 10 Déc 2020
One approach:
w = linspace(0 , pi , 260);
we = w((w < 0.4*pi) | (w > 0.5*pi)); % ‘w’ Edited
.

Catégories

En savoir plus sur Matrices and Arrays 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!

Translated by