From: Steve Amphlett on
"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
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.