Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Preallocation in MATLAB R2009a
Date: Wed, 5 Aug 2009 18:38:06 +0000 (UTC)
Organization: Universit&#228;tsSpital Z&#252;rich
Lines: 28
Message-ID: <h5cjie$2qc$1@fred.mathworks.com>
References: <h5c475$639$1@fred.mathworks.com> <h5c9nq$fsm$1@fred.mathworks.com> <h5cgs2$52$1@fred.mathworks.com> <h5chq4$3nt$1@fred.mathworks.com> <h5cikr$jh$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1249497486 2892 172.30.248.38 (5 Aug 2009 18:38:06 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 5 Aug 2009 18:38:06 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 11
Xref: news.mathworks.com comp.soft-sys.matlab:561094


"us "

the previous reply contains an unbelievably STUPID error...
here's the ...corrected... version

%    clear all;     % <- use this for proper testing... 
     clear r;     % <- save old stuff! 
     n=5000; 
tic; 
     r(n,n)=0;
toc 
     clear r; 
tic; 
     r=zeros(n); 
toc 
     clear r; 
tic 
     r=zeros(n,'double'); 
toc 
     clear r;
% results on a wintel sys: ic2/2*2.6gzh/2gb/winxp32.sp3/r2009a 
% after clear all;
% Elapsed time is 0.000046 seconds.     ONES()
% Elapsed time is 0.139465 seconds.     ZEROS()
% Elapsed time is 0.000054 seconds.     ZEROS(...,'double')

terribly sorry for confusion
us