From: Steve Amphlett on 4 Jun 2010 13:48 "Bruno Luong" <b.luong(a)fogale.findmycountry> wrote in message <hubdtt$4q8$1(a)fred.mathworks.com>... > HISTC, UNIQUE solutions will call for some kind of sorting, which can be penalizing for large array. Jeremy's for-loop solution has better theoretical complexity, but it's not vectorized. Another solution is: > > b = cumsum([1 diff(a)>0]) > > Bruno Yeah, but that's old-school ML. Clever and fun.
From: james bejon on 4 Jun 2010 14:03 I seem to recall, when stepping through the unique function once, that for biggish arrays, it performs an issorted check. So I wouldn't think there'd be much of a penalty in using it.
First
|
Prev
|
Pages: 1 2 Prev: Problem about controlling Pan and tilt of Logitech Orbit webcam Next: adjecent |