Removing large parts of an array
15 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have an array that has around 8000 elements. I wish to delete the last 7000 in a simple way, so that I am left with an array that has just the first 1000. Is there any way to do this?
2 commentaires
Réponse acceptée
Voss
le 20 Fév 2022
If it is a row or column vector:
x = randn(1,8000);
size(x)
last_n_to_remove = 7000;
x(end-last_n_to_remove+1:end) = [];
size(x)
6 commentaires
Plus de réponses (0)
Voir également
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!