help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to create automatically the variable name


From: Thomas D. Dean
Subject: Re: How to create automatically the variable name
Date: Sun, 24 Jun 2018 10:32:39 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

On 06/24/18 00:50, Leloup wrote:
Hello,
     I should like creating automatically the variable name. I tried :
  >>for K = 1:3,name = ["A",num2str(K)],endfor
name = A1
name = A2
name = A3
  However that fails because I need to associate to each variable A1, A2 to
data. For example A1 = 1, A2 = 2...
I tried:
for K = 1:10,["A",num2str(K)] = K,endfor
parse error:   invalid left hand side of assignment

eval(strcat('a',num2str(K),'=',num2str(K+1)))

Tom Dean



reply via email to

[Prev in Thread] Current Thread [Next in Thread]