From help-request at octave dot org Mon Nov 1 14:27:23 2004 Subject: Re: An array of arrays? From: Quentin Spencer To: Vic Norton CC: help at octave dot org Date: Mon, 01 Nov 2004 14:23:02 +0000 I think a cell array is what you're looking for. Each element of a cell array can have a different type and different dimensions. Cell arrays are indexed using {}. For example: octave:1> a{1} = 1; octave:2> a{2} = [1,1,1]; octave:3> a{3} = "string"; octave:4> a a = { [1,1] = 1 [1,2] = 1 1 1 [1,3] = string } I hope this helps. Quentin Vic Norton wrote: > Here is my problem. I have a subroutine > [X, S] = solsp(rtns, rtn0, noshort) > that produce a k x n matrix, X, and a k x 1 matrix, S, from a given m > x n matrix, rtns, an m x 1 matrix rtn0, and a (possibly empty) > submatrix, noshort, of [1 : n]. The integers m and n are fixed, but k, > the number of rows of X and S, varies, depending on the data matrices > rtns and rtn0. > > The matrices rtns and rtn0 are actually samples of historical returns > on certain investments ending at a certain week. I would like to run > through a bunch of end-weeks (wk = 1, 2, ..., N) and collect and save > the corresponding [X, S] output. The natural data structure would be a > list [X(wk), S(wk)] (wk = 1, 2, ..., N) of pairs of arrays of varying > row dimensions, k(wk) (wk = 1, 2, ..., N). Is there any reasonably > efficient way to create and save such a data structure in Octave? > > Note, all arrays contain floating point numbers except for the fixed > integer array noshort. > > Any ideas would be greatly appreciated. > > Regards, > > Vic Norton > ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------