Search All of the Math Forum:

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

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

 Messages: [ Previous | Next ]
 Sprinceana Posts: 1,132 Registered: 3/13/09
Transform matrix to vector
Posted: Jul 6, 2009 2:08 AM

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

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