how velocize element to be deleted

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

how velocize element to be deleted

Octave - General mailing list
hi, look this sequence of number n, i want to delete a duplicate number

n=10;
deleteFromElement=1;

c=[3 2 2 4  1 1 8 9 6 4]  %is a sequence of n number (also similar) (max
number is n)

v=unique(c);

for i=1:length(v)
  b=find(c==v(i));
  if length(b)>deleteFromElement
        canc=b(deleteFromElement+1:length(b));
        c(canc)=0;  % with 0 i delete it!
    endif
endfor

it's possibile avoid loop and velocize it? thank to help me



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html