[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to use Zeros(x,y,z) function
From: |
Mike Miller |
Subject: |
Re: How to use Zeros(x,y,z) function |
Date: |
Tue, 27 Dec 2005 22:13:04 -0600 (CST) |
On Tue, 27 Dec 2005, pUl| wrote:
Related post in the archives ->
http://www.octave.org/octave-lists/archive/help-octave.1998/msg00202.html
That's a related post from May 1998, which is 7.5 years ago. Happily,
things have changed since then!
MathLab supports zero function with more than two parameters. in MathLab,
B = zeros(d1,d2,d3...) or B = zeros([d1 d2 d3...]) returns an array of
zeros with dimensions d1-by-d2-by-d3-by-... .
I need to generate a zeros array with d1-by-d2-by-d3 (3D). But
according to the help Octave supports only for two parameters in Zeros
function. Is there any way of genarating this kind of matrix using
Octave?
In newer versions, this is supported. For example, I use version 2.1.71
and it does it just fine:
octave:1> zeros(2,3,4,2)
ans =
ans(:,:,1,1) =
0 0 0
0 0 0
ans(:,:,2,1) =
0 0 0
0 0 0
ans(:,:,3,1) =
0 0 0
0 0 0
ans(:,:,4,1) =
0 0 0
0 0 0
ans(:,:,1,2) =
0 0 0
0 0 0
ans(:,:,2,2) =
0 0 0
0 0 0
ans(:,:,3,2) =
0 0 0
0 0 0
ans(:,:,4,2) =
0 0 0
0 0 0
Mike
-------------------------------------------------------------
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
-------------------------------------------------------------