Removing large parts of an array
15 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
Voss
il 20 Feb 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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Matrices and Arrays in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!