Re: Best way to store multiple lists of different sizes?
- To: mathgroup at smc.vnet.net
- Subject: [mg48659] Re: Best way to store multiple lists of different sizes?
- From: Bill Rowe <readnewsciv at earthlink.net>
- Date: Wed, 9 Jun 2004 04:17:47 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
On 6/8/04 at 12:48 AM, greenberg at ucdavis.edu (Jonathan Greenberg)
wrote:
>I'm running a model which produces lists of different lengths after
>each iteration, and I want to somehow store them so I can do
>calculations on the lists after all the model runs are finished --
>is there some sort of variable that can handle this? For instance:
>Iteration 1: A={1,2,3,4}
>Iteration 2: A={1,2}
>Iteration 3: A={1,2,3,4,5,6}
>I'd like some sort of storage variable that is:
>B={1,2,3,4},{1,2},{1,2,3,4,5,6}
>So I can access the list doing this such as Length[B[[1,All]]] ->
>4, Length[B[[2,All]]] -> 2, etc... Thoughts?
Doesn't simply making B a list where each element is a variable length list containing the results of each iteration work for you?
That is
B={{1,2,3,4},{1,2},{1,2,3,4,5,6}}
allows such things as Length@B[[1,All]]. Do note the modifieer, All, isn't needed in this case, i.e., Length@B[[1]] gives the identical result
--
To reply via email subtract one hundred and four