Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Transform matrix to vector
Replies: 21   Last Post: Nov 25, 2014 1:55 PM

 Messages: [ Previous | Next ]
 Dave Robinson Posts: 1,338 Registered: 1/25/05
Re: Transform matrix to vector
Posted: Jul 6, 2009 5:42 AM

"Sprinceana " <mihaispr@yahoo.com> wrote in message <h2s4c1\$3aj\$1@fred.mathworks.com>...
> I have the matrix:
>
> A=[1 2 3;4 5 6; 6 7 8]
>
> And I want to obtain the vector line:
>
> 1 2 3 4 5 6 7 8
>
> What I did:
>

> >>A = [1 2 3;4 5 6; 6 7 8] % matrix definition
> >>b=A(1,:) % extract line 1 of matrix A in vector b
> >>c=A(2,:) % extract line 2 of matrix A in vector c

> >>d=A(3,:) % % extract line 3 of matrix A in vector d
> >>result=[b c d] %concatenate the 3 vectors b,c,d in a single vector result
> >>unique(result) % eliminate doubled elements from vector result

>
> Is there another method to obtain that? I wait your advices!

"Help reshape" maybe

Regards

Dave Robinson

Date Subject Author
7/6/09 Sprinceana
7/6/09 nor ki
7/6/09 Dave Robinson
7/6/09 ngreco32@gmail.com
7/6/09 alan
4/22/11 Ali
4/22/11 dpb
4/25/11 Steven Lord
4/25/11 dpb
9/26/13 Shooga
9/26/13 Steven Lord
5/11/14 Horia
5/11/14 Horia
5/11/14 dpb
11/25/14 Fabrizio Schiano
11/25/14 Bruno Luong
11/25/14 dpb
11/25/14 Bruno Luong
11/25/14 dpb
11/25/14 Bruno Luong
11/25/14 dpb
11/25/14 Bruno Luong