Removing a bunch of elements from a 1-D vector?
Ältere Kommentare anzeigen
I have a large 1-D vector and want to delete ten consecutive elements after the first or second or third one (depending on the signal undergoing processing). For example if my starting vector is x = [1,2,3,4,5,6,7,8,9,10,11........10,000], I want to create another vector which looks like: y = [1,(delete ten elements),12, (delete ten elements),23,(delete ten elements),34,....]. What is the best way to do such an operation?
Akzeptierte Antwort
Weitere Antworten (1)
Stalin Samuel
am 19 Jan. 2016
x = [1:1000];
gap = 10;%no of elements to be deleted
y = [min(x):gap+1:max(x)]
2 Kommentare
Dheeraj Kapur
am 19 Jan. 2016
@Dheeraj Kapur: this does not actually answer your question, because it does not select elements of the input vector as your original question requests, but instead creates an entirely new vector using the colon operator. This method will fail completely for any vector that is not a sequential sequence of integers with a step of one.
If you want a solution that actually selects elements of the input vector, regardless of their values, then see my answer. My method actually answers your question.
Kategorien
Mehr zu Logical finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!