Taking out entries of a Vector to make a new Vector
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Tom
am 11 Aug. 2019
Kommentiert: Stephen23
am 11 Aug. 2019
I have a 400 x 1 column vector, is it possible to 'splice' out every 4-th entry of that vector to end up with a 100 x 1 column vector, plus a 300 x 1 column vector left over from the original vector? Let me know if this doesn't make sense and I can explain further.
0 Kommentare
Akzeptierte Antwort
Stephen23
am 11 Aug. 2019
Bearbeitet: Stephen23
am 11 Aug. 2019
Where V is your vector:
X = V(4:4:end);
Y = V;
Y(4:4:end) = [];
2 Kommentare
Stephen23
am 11 Aug. 2019
"This seems to remove the first and the fifth entry and so on, I need to remove the fourth, the eighth, and so on."
Yes it did, because you did not specify the starting element. However changing the code is pretty trivial: I changed my answer from starting at element 1 to starting at element 4.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!