'Receiving invalid left hand side of assignment error where comparison is not appropriate

for [1:length(Vector)]
    Unique = unique(Vector)
    if any(ismember(Vector(i),Unique))
      v=Vector(i)
      Vector(i)=[]
      Unique = Unique(~ismember(v,Unique))
    endif
endfor

Here I am writing code, in octave, to remove all elements of Vector that aren't duplicates, leaving one less copy of each duplicate element in Vector. I am receiving error in line 2, where Unique is defined. The error is 'invalid left hand side of assignment error' which, after googling, is commonly due to use of assignment instead of comparison. However, comparison is not appropriate here. Please can someone help me.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source