[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: permute doesn't delete singletons
From: |
Bill Denney |
Subject: |
Re: permute doesn't delete singletons |
Date: |
Thu, 5 May 2005 13:02:01 -0400 (EDT) |
On Thu, 5 May 2005, Tom Holroyd wrote:
octave:75> x=zeros(10,1,2);
octave:76> z=permute(x,[3,1,2]);
octave:77> size(z)
ans =
2 10 1
I get a result with a trailing singleton dimension. I'm porting some
MATLAB code that expects the result of permute above to be size 2 10,
which it is under MATLAB. Can permute be changed to remove the
singleton dimension?
Sorry for the double reply, but you could also use the reshape command as
so:
x=zeros(10,1,2);
z=permute(x,[3,1,2]);
z=reshape(z, [2,10]);
Bill
--
"Hey, go buy a plane ticket to another state of mind, okay?" -- unknown
-------------------------------------------------------------
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
-------------------------------------------------------------