Path: news.mathworks.com!not-for-mail
From: "Yuri Geshelin" <geshelin@hotmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: eval, feval, global
Date: Thu, 27 Mar 2008 12:50:21 +0000 (UTC)
Organization: Bedford Institute of Oceanography
Lines: 24
Message-ID: <fsg56d$50c$1@fred.mathworks.com>
References: <fsebf0$43u$1@fred.mathworks.com>
Reply-To: "Yuri Geshelin" <geshelin@hotmail.com>
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 1206622221 5132 172.30.248.37 (27 Mar 2008 12:50:21 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 27 Mar 2008 12:50:21 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1149396
Xref: news.mathworks.com comp.soft-sys.matlab:459460


Many thanks to everyone who replied.

The fastest algorithm is Phil's. Assuming that its time is 
unity, here is the cpu time summary of the following test 
case:

t = cputime; <code_name>(1:10,1000001:1000010); <code_time> 
= cputime-t;

-------------------------------------

Phil's construct_array4.m - 1.00
My awkward EVAL implementation (construct_array.m) - 1.67
mmrepeat - 3.40
Sven's code - 3.47
My original version (no preallocation) - 4.00

------------------------------------

You convinced me that EVAL is beatable.

I will get back to you shortly and present another 
situation, in which I make use of eval.