From: Bruno Luong on
A=[ 1 2
3 4
5 6
7 8
9 10
11 12]

reshape(permute(reshape(A,[3 2 2]),[3 2 1]),[4 3]).'

% Bruno
From: Steven Lord on

"santhosh " <santhosh.ayalur(a)gmail.com> wrote in message
news:hrjssr$8gt$1(a)fred.mathworks.com...
> "Wayne King" <wmkingty(a)gmail.com> wrote in message
> <hrjqr8$rbk$1(a)fred.mathworks.com>...
>> "santhosh " <santhosh.ayalur(a)gmail.com> wrote in message
>> <hrjm91$5mg$1(a)fred.mathworks.com>...

*snip*

> a=
>> > 1 2
>> > 3 4
>> > 5 6
>> > 7 8
>> > 9 10
>> > 11 12
>> > using reshape
> b=reshape(a,3,4)
> , i end up as b =
>
> 1 7 2 8
> 3 9 4 10
> 5 11 6 12
>
> while inded what i need is
> 1 2 7 8
> 3 4 9 10
> 5 6 11 12.
>
> I also did b=reshape(a,3,2,2), but then the outpus is not what i wanted.
>
> Basically i have a (m*1024)*4 matrix. I only want to reshape m into say
> 'p', but maintaining the *4 structure.
>
> I havent been able to do that in one command.

*sigh* Why is everyone always obsessed with doing everything in one command?
Writing two commands to achieve your goal isn't the end of the world, is it?

% generate sample data
A = reshape(1:12, 2, 6).';

% The engine
b1 = reshape(A, 3, 4);
b = [b1(:, 1:2:end) b1(:, 2:2:end)]

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ


From: Mark Shore on
"Steven Lord" <slord(a)mathworks.com> wrote in message

> *sigh* Why is everyone always obsessed with doing everything in one command?


Perhaps aiming for the Zen of a zero line command?
From: John on
"Steven Lord" <slord(a)mathworks.com> wrote in message
> *sigh* Why is everyone always obsessed with doing everything in one command?

It's Matlab's fault for trying to provide syntax and functions to do anything imaginable in one command! ;-)