Path: news.mathworks.com!newsfeed-00.mathworks.com!kanaga.switch.ch!switch.ch!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.straub-nv.de!feeder.eternal-september.org!eternal-september.org!not-for-mail
From: dpb <none@non.net>
Newsgroups: comp.soft-sys.matlab
Subject: Re: initialising a 3D matrix
Date: Sun, 08 Nov 2009 19:52:44 -0600
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <hd7slj$f9f$1@news.eternal-september.org>
References: <hd7rrl$b8c$1@fred.mathworks.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.eternal-september.org U2FsdGVkX1+4ENRMqajhqdBM1pdCubvaEeNLQk+oed+t/IpzmdopkBW4stdVaCIwLW8DMRrC7CaSj07FdOvhS4HA9Ff78Bp4w+WaaSeQdrn9pbneNRxxA9AKzkF3YQff0zpnpFv01nI=
X-Complaints-To: abuse@eternal-september.org
NNTP-Posting-Date: Mon, 9 Nov 2009 01:52:51 +0000 (UTC)
In-Reply-To: <hd7rrl$b8c$1@fred.mathworks.com>
X-Auth-Sender: U2FsdGVkX1+BmYH3UGGhtLRx2J2rVWdJ1ToefUp5RwY=
Cancel-Lock: sha1:u4DjpxBxZlu5mXZirz/34dU45Tw=
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
Xref: news.mathworks.com comp.soft-sys.matlab:583449


Madhumitha Iyer wrote:
> [0 0;0 1;1 0;1 1]
> ans =
>      0     0
>      0     1
>      1     0
>      1     1
>>> size(ans)
> ans =
>      4     2
> Hellp all,
> From the above code we see that the matrix defined is a 4*2
> matrix.Now if I want to extend this to a 4*2*50 matrix and initialise
> it with whatever values I want how can I do it in matlab?Pls tell
> me.thanx

x = zeros(4,2,50);

Write code of whatever form needed to initialize it.  If you mean you 
want all 50 planes identical

y = repmat(x, [1 1 50]);

is one way
--