From help-request at octave dot org Fri Feb 11 11:45:28 2005 Subject: Re: Array of variable dimension From: Andrey Romanenko To: help at octave dot org Date: Fri, 11 Feb 2005 17:16:35 +0000 On Friday 11 February 2005 16:54, Deepak, R. wrote: > How can I create an 'y'-dimensional array of zeros, where each dimension > can take (2 * n + 2) values? > > 'y' and 'n' are variables given at runtime. Like this? y=3; n=2; nn=2*n+2; ss=sprintf("zz=zeros(%d",nn); for i=2:y ss=strcat(ss, sprintf(",%d", nn)); endfor; ss=strcat(ss, ");"); eval(ss) zz Andrey ------------------------------------------------------------- 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 -------------------------------------------------------------