28

I have a vector with 100 elements. I have another vector with index positions of elements I want to remove from this vector.

How do I do this?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Ted Flethuseo
  • 385
  • 2
  • 5
  • 7
  • 3
    Here are a couple questions that are very nearly duplicates, since removing array elements is a component of the answers (although other issues are also covered): [MATLAB: what's the most elegant (efficient) way to delete known elements in a matrix?](http://stackoverflow.com/questions/683488/matlab-whats-the-most-elegant-efficient-way-to-delete-known-elements-in-a-mat), [matlab: delete elements from matrix](http://stackoverflow.com/questions/572021/matlab-delete-elements-from-matrix). I think I'll try to edit some titles and tags so these are easier to find in the future. ;) – gnovice Sep 24 '10 at 18:42

1 Answers1

43
vector(indecies) = []

example:

>> a = 1:10;
>> a([3,4,7]) = []

a =

     1     2     5     6     8     9    10
second
  • 28,029
  • 7
  • 75
  • 76