On Sunday, June 24, 2018, 10:51:50 AM GMT+3, Leloup <address@hidden> 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
>> 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
--
| Octave - Octave - General | Mailing List ArchiveOctave - General forum and mailing list archive. |
|
|
"Do you have an idea?" - how about using a struct and its keys as variable names ?
Start from 'help struct' within Octave.
--Sergei.