Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Basic Matlab Question
Date: Tue, 17 Nov 2009 16:17:18 +0000 (UTC)
Organization: Battelle Energy Alliance (INL)
Lines: 15
Message-ID: <hduiae$7t7$1@fred.mathworks.com>
References: <hdso7p$sh5$1@fred.mathworks.com> <hdsqh1$flv$1@fred.mathworks.com> <hducuk$r51$1@fred.mathworks.com> <hdufnf$mv1$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 1258474638 8103 172.30.248.38 (17 Nov 2009 16:17:18 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 17 Nov 2009 16:17:18 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 688530
Xref: news.mathworks.com comp.soft-sys.matlab:585807


"Doug " <nospam@thx.com> wrote in message 
> From the FAQ mentioned, "Now, if you still really want to create variables with dynamically generated names, you need to use EVAL. With EVAL, you use MATLAB commands to generate the string that will perform the operation you intend."
> 
> I agree this is not the best way to go about things and I wouldn't do it, but the FAQ itself spells out how to do what the OP wants to do using EVAL.
> 
> My advice to the OP is use what works for you to solve your problem.  When you get more experience with Matlab, follow Steve's advice above and use S(n, :) instead of creating more variables.


I would say that this last bit is backwards.  EVAL should be unknown to beginners and rarely used by advanced users.  When a beginner starts using eval, he will come back to this NG with one (or more) of the following complaints:

1.  My code is very slow, help me speed it up.
2.  My code doesn't work and I cannot figure out why.
3.  MATLAB closed by itself and I don't know why.

I have seen it again and again.  EVAL has its place, but IMO, it is not in a beginner's hands.