Path: news.mathworks.com!not-for-mail
From: "Christian " <chris_at_mac@mac.com>
Newsgroups: comp.soft-sys.matlab
Subject: use variable as variable name
Date: Thu, 29 Oct 2009 13:45:19 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 17
Message-ID: <hcc69f$99s$1@fred.mathworks.com>
Reply-To: "Christian " <chris_at_mac@mac.com>
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 1256823919 9532 172.30.248.38 (29 Oct 2009 13:45:20 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 29 Oct 2009 13:45:19 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1525055
Xref: news.mathworks.com comp.soft-sys.matlab:580967


Hi!
I have a problem with naming variables. E.g.:

a=2;
b=3;

And I would like to create a variable c_2_3 and assign a value to it, e.g.:

c_2_3=4.

How can I do this automatically, so that Matlab is naming my variables according to the value of a and b? I tried num2str and string concatenation:

strcat('c',num2str(a),num2str(b))=4, but that does not work...

Any ideas? Thanks a lot!

Chris