Path: news.mathworks.com!not-for-mail
From: "jay vaughan" <jvaughan5.nospam@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: eval begone!  (part 2)
Date: Mon, 21 Apr 2008 19:43:04 +0000 (UTC)
Organization: harvard
Lines: 22
Message-ID: <fuiqo8$heq$1@fred.mathworks.com>
Reply-To: "jay vaughan" <jvaughan5.nospam@gmail.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 1208806984 17882 172.30.248.37 (21 Apr 2008 19:43:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 21 Apr 2008 19:43:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1215048
Xref: news.mathworks.com comp.soft-sys.matlab:464397


Hi Matlab folks,

I am continuing the process of purging eval statements from
my code, but got stuck on another one. Anybody know a way to
avoid eval here? A minimal version of my current code is below.

First, the user gives a file name. Then the name of the most
updated version of a particular routine (which I update
frequently) is returned by the function get_most_recent_func 
which finds the name of the most recent .m file with the
base name given by func_basename in the directory func_path.
Finally the most recent function is called (for now using
eval) with FileName as the argument.

func_basename = 'my_func';
FileName = uigetfile;
func_name = get_most_recent_func(func_path, func_basename);
eval([func_name '(''' FileName ''')']);


Thanks,
J