Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Help in vectorizing code
Date: Tue, 28 Apr 2009 01:40:19 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 8
Message-ID: <gt5mq3$bs$1@fred.mathworks.com>
References: <1e6f5074-edce-417a-b0a5-b62db0fb033f@w31g2000prd.googlegroups.com>
Reply-To: <HIDDEN>
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 1240882819 380 172.30.248.37 (28 Apr 2009 01:40:19 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 28 Apr 2009 01:40:19 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1708920
Xref: news.mathworks.com comp.soft-sys.matlab:535839



This is one way to make the mask quickly
mask = zeros(size(d));
mask(:,idxs) = 1;
mask = cumsum(mask,1);

Hth
Darren