[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: variables of variables, or how is it calle?
From: |
Ben Abbott |
Subject: |
Re: variables of variables, or how is it calle? |
Date: |
Sun, 8 Jul 2007 12:05:28 -0700 (PDT) |
cadu aranha wrote:
>
> Hi people,
> i would like to create the following structure in octave: A(n),
> where the variable A has different values at different indexes n (n is
> a natural).
> The value A(1) can be a 2x2 matrix whereas A(2) can be a 5x2 matrix.
> Is there a way to create such a thing in octave?
>
> I my case A(i) is a decay with (x,y) values. I want to handle set of
> decays that
> can have different number of points (different number of lines at A),
> and at each problem i can have a different number of decays A(i) as well.
>
> Bellow an example. First column is the index i, second x, third y.
> Here I have A(1) and A(2) with respectively 10 and 16 (x,y) data points.
> 1 1 56.016841
> 1 2 53.772628
> 1 3 51.045499
> 1 4 48.842047
> 1 5 45.950329
> 1 6 43.296211
> 1 7 40.710709
> 1 8 37.918308
> 1 9 35.222342
> 1 10 32.622573
> 2 1 140.303195
> 2 2 134.534164
> 2 3 128.325421
> 2 4 121.956538
> 2 5 115.326132
> 2 6 108.597705
> 2 7 101.801594
> 2 8 94.929417
> 2 9 88.119899
> 2 10 81.532634
> 2 11 75.074571
> 2 12 68.796452
> 2 13 62.823703
> 2 14 57.095960
> 2 15 51.758466
> 2 16 46.634026
>
> Thanks in advance for any tip ...
>
As Michael indicated, cell-arrays are likely what you're looking for.
Respecting your 2x2 and 5x2 matrices;
octave:1> A{1} = [1,2;3,4];
octave:2> A{2} = ones(5,2)
A =
{
[1,1] =
1 2
3 4
[1,2] =
1 1
1 1
1 1
1 1
1 1
}
Is that what you needed?
--
View this message in context:
http://www.nabble.com/variables-of-variables%2C-or-how-is-it-calle--tf4045172.html#a11491624
Sent from the Octave - General mailing list archive at Nabble.com.