Path: news.mathworks.com!not-for-mail
From: "Nizar " <pakoeli@hotmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: how to rename a workspace variable in a loop?
Date: Thu, 19 Jul 2007 21:34:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 9
Message-ID: <f7olca$1mj$1@fred.mathworks.com>
Reply-To: "Nizar " <pakoeli@hotmail.com>
NNTP-Posting-Host: webapp-01-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1184880842 1747 172.30.248.36 (19 Jul 2007 21:34:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 19 Jul 2007 21:34:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 939301
Xref: news.mathworks.com comp.soft-sys.matlab:419995



Hi,

I was wondering how you could rename a workspace variable in a loop? What I have is a loop that generates results which are stored in a matrix. the problem is that in the 2nd loop the matrix is overwritten. I also cannot add both matrices, because they are not of the same size. 

Therefore i wanted to know how to rename the workspace variable for each loop generation. for example when using a "for" loop with i=1:1:5 how can I name the matrix M for each loop with a increment, thus M1, M2, M3, etc... so that I can analyze all the data and not that of only the last loop.

any suggestions are appreciated.

thank you