Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Why are cell arrays so much faster?
Date: Fri, 11 Jul 2008 21:05:06 +0000 (UTC)
Organization: Battelle Energy Alliance (INL)
Lines: 19
Message-ID: <g58hu2$77a$1@fred.mathworks.com>
References: <g58e4n$13t$1@fred.mathworks.com> <g58g05$ie3$1@fred.mathworks.com>
Reply-To: <HIDDEN>
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 1215810306 7402 172.30.248.35 (11 Jul 2008 21:05:06 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 11 Jul 2008 21:05:06 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 688530
Xref: news.mathworks.com comp.soft-sys.matlab:478935




> 
> >> tic; a=repmat(1000,300,360); toc;
> Elapsed time is 0.003951 seconds.
> >> tic; b=1000.*ones(300,360); toc;
> Elapsed time is 0.005800 seconds.
> 
> For some reason, I always thought of repmat as being slower 
> than matrix operations. Maybe I'll start using it more now 
> =).
> 
> Ken

On my machine: 

tic; a=repmat(1000,300,360); toc;
Elapsed time is 0.035981 seconds.
tic; b=1000.*ones(300,360); toc;
Elapsed time is 0.003114 seconds.