Path: news.mathworks.com!not-for-mail
From: "us " <us@neurol.unizh.ch>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Optimize this!
Date: Fri, 8 Feb 2008 02:29:03 +0000 (UTC)
Organization: Universit&#228;tsSpital Z&#252;rich
Lines: 22
Message-ID: <fogepf$a4$1@fred.mathworks.com>
References: <5b74607b-c527-4c9b-833a-b08d4be5d48a@s13g2000prd.googlegroups.com> <fogavj$ae4$1@fred.mathworks.com>
Reply-To: "us " <us@neurol.unizh.ch>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1202437743 324 172.30.248.37 (8 Feb 2008 02:29:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 8 Feb 2008 02:29:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 11
Xref: news.mathworks.com comp.soft-sys.matlab:450033


"John D'Errico":
<SNIP has a bad hair day...

> I wonder if its possible that the other returned
> arguments might be of interest. The third one
> maybe...

hmmmmmm... <john>...

% the user wants
     vu=[3 7 2 2 3 100 7 56];
     ru=[1 2 3 3 1 4 2 5];

% now, we both know that none of <unique>'s outputs
% will achieve this... in particular: #3 is useless
% in this case... unless...

     [a,a,b]=unique(vu,'first');
     [r,r]=histc(a(b),unique(a(b)));
     [vu;b;ru;r]

us