Removing large parts of an array
15 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Stefan Ganescu
am 20 Feb. 2022
Bearbeitet: Voss
am 20 Feb. 2022
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 Kommentare
Akzeptierte Antwort
Voss
am 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!