From: "Bruno Luong" <b.luong@fogale.findmycountry>
Newsgroups: comp.soft-sys.matlab
Subject: Re: FAST algorithm to jenga matrix?
Date: Sun, 29 Mar 2009 10:32:45 +0000 (UTC)
Organization: FOGALE nanotech
Lines: 8
Message-ID: <gqniod$6ne$>
References: <gqmlmt$6tp$> <gqn6u7$1s2$> <gqnf8d$8kh$>
Reply-To: "Bruno Luong" <b.luong@fogale.findmycountry>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: 1238322765 6894 (29 Mar 2009 10:32:45 GMT)
NNTP-Posting-Date: Sun, 29 Mar 2009 10:32:45 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 390839
Xref: comp.soft-sys.matlab:528436

Here is a four-liner solution. I could merge the 2nd and 3rd lines but it does not bring any advantage beside having less lines:

[I J Val]=find(A);
u = unique(Val); % 1:n
[f NewVal]=ismember(u,setdiff(u,d));

% Bruno