Path: news.mathworks.com!not-for-mail
From: "Bruno Luong" <b.luong@fogale.findmycountry>
Newsgroups: comp.soft-sys.matlab
Subject: Rearranging an array by collecting values
Date: Fri, 26 Aug 2011 12:04:26 +0000 (UTC)
Organization: FOGALE nanotech
Lines: 10
Message-ID: <j3824a$abk$1@newscl01ah.mathworks.com>
References: <go2g1h$jtl$1@fred.mathworks.com> <go2u93$1tg$1@fred.mathworks.com> <j377tm$rkt$1@newscl01ah.mathworks.com> <j37dnb$dpo$1@newscl01ah.mathworks.com> <j37edq$fhl$1@newscl01ah.mathworks.com> <j37fsm$jd7$1@newscl01ah.mathworks.com> <j37n73$a6c$1@newscl01ah.mathworks.com> <j37pnm$h18$1@newscl01ah.mathworks.com> <j37ufj$bn$1@newscl01ah.mathworks.com>
Reply-To: "Bruno Luong" <b.luong@fogale.findmycountry>
NNTP-Posting-Host: www-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1314360266 10612 172.30.248.37 (26 Aug 2011 12:04:26 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 26 Aug 2011 12:04:26 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 390839
Xref: news.mathworks.com comp.soft-sys.matlab:741333

Don't you have enough? Here is another one

b = [true; diff(A(:,1))~=0];
l = diff(find([b; true]));
B = bsxfun(@le,ndgrid(1:max(l),1:length(l)),l.');
C = zeros(size(B));
C(B) = A(:,2);
[A(b,1) C']

Bruno