help-octave
[Top][All Lists]
Advanced

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

Creating 3D matrices


From: Colin Ingram
Subject: Creating 3D matrices
Date: Thu, 17 Nov 2005 19:43:15 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050923 Thunderbird/1.0.7 Mnenhy/0.7.2.0

I've been having some problems working with 3D matrices.  I'll start
with the easy stuff.

Is there a better way to make a matrix of indices in the third dimension
than this?

X = 50;
Y = 80;
Z = 100;
matrix = zeroes(X,Y,Z);
for i = [1:Z]
   matrix(:,:,i)=i*ones(X,Y);
endfor

on a similar note is there a better to build this matrix

X = 50;
Y = 80;
Z = 100;
randmat = rand(X,Y);
matrix = zeroes(X,Y,Z);
for i = [1,Z]
   matrix(:,:,i)=randmat;
endfor

I guess those are the same question but maybe there is a trick on the
first one using a range vector?



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