Path: news.mathworks.com!not-for-mail
From: "John D'Errico" <woodchips@rochester.rr.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Using workspace variable in m-file
Date: Sat, 6 Sep 2008 08:51:02 +0000 (UTC)
Organization: John D'Errico (1-3LEW5R)
Lines: 14
Message-ID: <g9tg9l$55$1@fred.mathworks.com>
References: <g9t86u$cu5$1@fred.mathworks.com> <g9td2h$se1$1@fred.mathworks.com>
Reply-To: "John D'Errico" <woodchips@rochester.rr.com>
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 1220691062 165 172.30.248.35 (6 Sep 2008 08:51:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 6 Sep 2008 08:51:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 869215
Xref: news.mathworks.com comp.soft-sys.matlab:488907



"Husam Aldahiyat" <numandina@gmail.com> wrote in message <g9td2h$se1$1@fred.mathworks.com>...
> Use global. Solves all life's problems.

Yes, and it creates other problems. Globals
are sloppy, lazy programming.

Pass the variables in. If they are functions,
perhaps anonymous functions, or simply
variables, then it is far simpler to pass them
in as arguments to the function. This solves
the OP's problems without creating other
ones.

John