Thread Subject: initialising a 3D matrix

Subject: initialising a 3D matrix

From: Madhumitha Iyer

Date: 9 Nov, 2009 01:39:01

Message: 1 of 3

[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

Subject: initialising a 3D matrix

From: dpb

Date: 9 Nov, 2009 01:52:44

Message: 2 of 3

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

Subject: initialising a 3D matrix

From: Madhumitha Iyer

Date: 9 Nov, 2009 02:31:02

Message: 3 of 3

Thank you for this information.It was really helpful.

"Madhumitha Iyer" <pyarsa_madhu@yahoo.co.in> wrote in message <hd7rrl$b8c$1@fred.mathworks.com>...
> [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

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
3d matrix astro mmi 8 Nov, 2009 20:44:03
rssFeed for this Thread

Contact us at files@mathworks.com