Path: news.mathworks.com!not-for-mail
From: "Bruno Luong" <b.luong@fogale.findmycountry>
Newsgroups: comp.soft-sys.matlab
Subject: Re: vectorizing challenge
Date: Wed, 20 May 2009 07:04:02 +0000 (UTC)
Organization: FOGALE nanotech
Lines: 13
Message-ID: <gv0a12$lb7$1@fred.mathworks.com>
References: <guvhl1$qif$1@fred.mathworks.com>
Reply-To: "Bruno Luong" <b.luong@fogale.findmycountry>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1242803042 21863 172.30.248.35 (20 May 2009 07:04:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 20 May 2009 07:04:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 390839
Xref: news.mathworks.com comp.soft-sys.matlab:541168


"Heywood " <heywoodj123@yahoo.com> wrote in message <guvhl1$qif$1@fred.mathworks.com>...

> result = zeros(1,length(V));
> for kk = 1:length(V);
>   ind = find( V(kk) <= R, 1, 'first' );
>   result(kk) = R(ind);
> end;

If speed is your main concern, don't use INTERP1 (slow), use HISTC or FIND_IDX on FEX

http://www.mathworks.com/matlabcentral/fileexchange/23049

Bruno