Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: genvarname doesn't work
Date: Fri, 10 Jul 2009 22:02:03 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 19
Message-ID: <h38dor$hld$1@fred.mathworks.com>
References: <h37t8i$6kh$1@fred.mathworks.com> <op.uwu54zbja5ziv5@uthamaa.dhcp.mathworks.com> <h389nd$omc$1@fred.mathworks.com> <h38a6i$pud$1@fred.mathworks.com> <h38c66$5f9$1@fred.mathworks.com>
Reply-To: <HIDDEN>
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 1247263323 18093 172.30.248.37 (10 Jul 2009 22:02:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 10 Jul 2009 22:02:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1646679
Xref: news.mathworks.com comp.soft-sys.matlab:554587


I read the FAQ page, thank you Steven and Oleg.  
It seems that Matlab is very adament about us not poofing variable names at runtime.

Is this only because it's harder to read, and therefore harder to debug ?? 

Because they could change the syntax so that it's not so hard to read:

x=['a' 'b' 'c' 'd']; 
for i=1:4
 Mygenvarname(x(i))=i
end

The reason why is that, for a very hypothetical example, say the letter n represents the number of occurrences of 'n' in an article.

If I want to report that number from an array, I would have to figure out that n is the 14th letter of the alphabet, and type the command array(14) to get my result.  What if I don't know off the top of my head that n is 14th in the alphabet ?? I would rather be able to just type "n" and get my answer.

Matlab's solution to this on the FAQ page is to use a structure s.a, a.b, s.c .... s.n ....

I'm not too familiar with structures .. but it seems as if they take up more memory and are a more complex data structure in general .. it seems like its harder to access or view information contained in them.. I'm probably wrong, but can someone please explain to me why ??