From: Haris Hameed on

If there is a matrix A
A = (1,1) (1,2) (1,3)
(2,1) (2,2) (2,3)
(3,1) (3,2) (3,3)
How to write matrix X

X = (1,2)
(1,3)
(2,2)
(2,3)
(3,2)
(3,3)

Actually matrix A elements vary, may be (3x3) , (4x3) ------ (16x3)
Number of rows vary , column fix
I want generate matrix X
From: dpb on
Haris Hameed wrote:
>
> If there is a matrix A
> A = (1,1) (1,2) (1,3)
> (2,1) (2,2) (2,3)
> (3,1) (3,2) (3,3) How to write matrix X
>
> X = (1,2)
> (1,3)
> (2,2)
> (2,3)
> (3,2)
> (3,3)
>
> Actually matrix A elements vary, may be (3x3) , (4x3) ------ (16x3)
> Number of rows vary , column fix
> I want generate matrix X

x=a(:,2:end)';

If want the single column vector as shown in row order,

y = x'; x=x(:);

or

reshape(x',numel(x),1)

BTW, chill on the hurries... :(

--
From: Haris Hameed on
dpb <none(a)non.net> wrote in message <htr820$sa$1(a)news.eternal-september.org>...
> Haris Hameed wrote:
> >
> > If there is a matrix A
> > A = (1,1) (1,2) (1,3)
> > (2,1) (2,2) (2,3)
> > (3,1) (3,2) (3,3) How to write matrix X
> >
> > X = (1,2)
> > (1,3)
> > (2,2)
> > (2,3)
> > (3,2)
> > (3,3)
> >
> > Actually matrix A elements vary, may be (3x3) , (4x3) ------ (16x3)
> > Number of rows vary , column fix
> > I want generate matrix X
>
> x=a(:,2:end)';
>
> If want the single column vector as shown in row order,
>
> y = x'; x=x(:);
>
> or
>
> reshape(x',numel(x),1)
>
> BTW, chill on the hurries... :(
>
> --


THANKX ........................... :)
 | 
Pages: 1
Prev: how to write matrix X
Next: Build EX Problem