From: IAN SAl on
Hi everyone

I have 3 dim. matrix and would change it into 2 dim one.

for examples

A1(:,:,1) =

1 2 3
4 5 6

A1(:,:,2) =

7 8 9
10 11 12

A1(:,:,3) =

13 14 15
16 17 18

I would sort them like each matrix under the one before in 2 dim matrix to be

Anew =

1 2 3
4 5 6
7 8 9
10 11 12
13 14 15
16 17 18

i have used this command Anew=[A1(:,:,1);A1(:,:,2);A1(:,:,3)]

but i have huge No of matrices so its not a good idea to sort them by this command

I have tried squeeze but i find , what i had used , is to deal with rows or something needs me to take long route to reach.


Any helps would be greatly appreciates with considering that i have many huge matrices

Regards
IAN
From: us on
"IAN SAl" <ib52(a)hotmail.com> wrote in message <hsj9hl$iit$1(a)fred.mathworks.com>...
> Hi everyone
>
> I have 3 dim. matrix and would change it into 2 dim one.
>
> for examples
>
> A1(:,:,1) =
>
> 1 2 3
> 4 5 6
>
> A1(:,:,2) =
>
> 7 8 9
> 10 11 12
>
> A1(:,:,3) =
>
> 13 14 15
> 16 17 18
>
> I would sort them like each matrix under the one before in 2 dim matrix to be
>
> Anew =
>
> 1 2 3
> 4 5 6
> 7 8 9
> 10 11 12
> 13 14 15
> 16 17 18
>
> i have used this command Anew=[A1(:,:,1);A1(:,:,2);A1(:,:,3)]
>
> but i have huge No of matrices so its not a good idea to sort them by this command
>
> I have tried squeeze but i find , what i had used , is to deal with rows or something needs me to take long route to reach.
>
>
> Any helps would be greatly appreciates with considering that i have many huge matrices
>
> Regards
> IAN

a hint:
- this FEX submission does what you want...

http://www.mathworks.com/matlabcentral/fileexchange/20255

% in essence
% - it reshapes a ND1 -> ND2 row-col wise...

ns=size(nd);
nd=permute(nd,[1,3:numel(ns),2]);
nd=reshape(nd,[],ns(2));

us
From: IAN SAl on
Thanks US for help

I don't know how to use it . Does it need some to be installed or there is a specific way to use it?

Thanks

IAN
From: us on
"IAN SAl" <ib52(a)hotmail.com> wrote in message <hsjjck$jfl$1(a)fred.mathworks.com>...
> Thanks US for help
>
> I don't know how to use it . Does it need some to be installed or there is a specific way to use it?
>
> Thanks
>
> IAN

well... if you refer to the FEX submission
- download it to a folder in your ML path (or working folder)...
- use it...

us
From: IAN SAl on
Great help us

Thanks very much

IAN