help-octave
[Top][All Lists]

## some multi-dimensional matrix problem

 From: Bart Vandewoestyne Subject: some multi-dimensional matrix problem Date: Fri, 21 May 2004 04:02:30 -0500 User-agent: Mutt/1.3.28i

Suppose you had a multi-dimensional matrix p that looked like:

>> p

p(:,:,1) =

0.8995    0.3137    0.2517    0.4330    0.8424

p(:,:,2) =

0.1845    0.5082    0.4522    0.3256    0.3801

I'm sure from my calculations that p(:,:,x) is always a 1xN vector.
Now I want to combine all these 1xN vectors into a single result matrix,
and I'm currently doing it like this (M is the max last dimension of p):

for j=1:M,
res(j,:) = p(:,:,j);
end

which gives me what i want, but I was wondering if there's a faster,
more vectorized way...

Thanks,
Bart

--
!!!!!!!!!!!!!!!!!!! email change !!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

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