help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Array of variable dimension


From: Andrey Romanenko
Subject: Re: Array of variable dimension
Date: Fri, 11 Feb 2005 17:16:35 +0000
User-agent: KMail/1.7.1

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
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]