Path: news.mathworks.com!newsfeed-00.mathworks.com!news.kjsl.com!news.glorb.com!news2.glorb.com!news.glorb.com!tr22g12.aset.psu.edu!news.mathforum.org!not-for-mail
From: Chan Huntington <channing@umich.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Re: how to name a vector with a variable name to store previous
 results
Date: Sat, 07 Nov 2009 18:21:04 EST
Organization: The Math Forum
Lines: 8
Message-ID: <579952079.33016.1257636095068.JavaMail.root@gallium.mathforum.org>
References: <hd4sit$f6r$1@fred.mathworks.com>
NNTP-Posting-Host: gallium.mathforum.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: support1.mathforum.org 1257636095 10404 144.118.94.39 (7 Nov 2009 23:21:35 GMT)
X-Complaints-To: news@news.mathforum.org
NNTP-Posting-Date: Sat, 7 Nov 2009 23:21:35 +0000 (UTC)
Xref: news.mathworks.com comp.soft-sys.matlab:583270


Hi Jose,

If i understand your question correctly, you should be able to use 'eval', which concatenates a string and evaluates it as an expression.  From your description:

>> eval(['result_i', num2str(i),'_j',num2str(j),'_k',num2str(k),' = [23 34 45 56 78]'])

You might also find the function genvarname to be useful.  Best,
Chan