How to delete every alternate rows?
18 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Turbulence Analysis
le 5 Avr 2024
Commenté : Aquatris
le 5 Avr 2024
Hi,
In the attached array sz, I need to delete every alternate rows starting from first row, (e.g. 1, 3, 5, 7 etc). Could someone help?
1 commentaire
Dyuman Joshi
le 5 Avr 2024
You have been active here since 2020, I am really surprised that you had to ask for this.
Réponse acceptée
Ayush Anand
le 5 Avr 2024
Hi,
You can do
sz_new = sz(2:2:end, :);
This will do the job.
4 commentaires
Aquatris
le 5 Avr 2024
Alternatively you can also delete them from your current variable:
x = 1:10;
x % show x
x(1:2:end) = [];% delete odd idx values
x % show x after removing odd values
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Install Products 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!