help-octave
[Top][All Lists]
Advanced

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

How to create automatically the variable name


From: Leloup
Subject: How to create automatically the variable name
Date: Sun, 24 Jun 2018 00:50:49 -0700 (MST)

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
>> for K = 1:3,A{K} = K,endfor
A =
{
  [1,1] =  1
}
A =
{
  [1,1] =  1
  [1,2] =  2
}
A =
{
  [1,1] =  1
  [1,2] =  2
  [1,3] =  3
}
There, class of variable  is cell and I should like getting double

Do you have an idea?

Regards,
Le loup



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html



reply via email to

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