Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: how to name a vector with a variable name to store previous results
Date: Sat, 7 Nov 2009 22:33:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 28
Message-ID: <hd4sit$f6r$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 1257633181 15579 172.30.248.37 (7 Nov 2009 22:33:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 7 Nov 2009 22:33:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2082133
Xref: news.mathworks.com comp.soft-sys.matlab:583267


Hello,
I have been tryiing to defene a vector which has to have a diferent name acording to some variables, in order to keep the results from previous results,

let say for example, I am studying the effect of 3 variables in a process, then:
from previous calculations I have  all the results for each case, made by loops,, now I need to store all this reults in a vecto wich the name is denined by the correpondent case:

let say, the variables are "i", "j" and "k", 
then for example when i=2, j=5 and k=7, the result from previous calculations is

result = [23 34  45 56 78]

I can create the name like this:
for i = 1:imax                  
  for j=1:jmax 
    for k = 1:kmax
       name = sprintf (result_j%d_j%d_k%d',[i j k])
    end
   end 
end

.. Now, how can I define that "name" is equal to the vector "result" ???
  
to finally get, for example:
                        result_i2_j5_k7 = [23 34  45 56 78]

Thank you very much for you help,
Regards.