Re: matrix
- To: mathgroup at smc.vnet.net
- Subject: [mg107113] Re: [mg107073] matrix
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Wed, 3 Feb 2010 06:09:27 -0500 (EST)
- Reply-to: hanlonr at cox.net
N is a reserved word. Start your variable names with lowercase to avoid conflicts with built-in symbols.
m = {{1, 2}, {3, 4}, {5, 6}, {7, 8}};
n = {{1, 8}, {5, 0}, {9, 7}};
m1 = Select[m, MemberQ[n[[All, 1]], First[#]] &]
{{1, 2}, {5, 6}}
n1 = Select[n, MemberQ[m[[All, 1]], First[#]] &]
{{1, 8}, {5, 0}}
Bob Hanlon
---- Piotr Munik <piotr.munik at gmail.com> wrote:
=============
I have matrix M and matrix N
for example
M={{*1*,2},{3,4},{*5*,6},{7,8}}
N={{*1*,8},{*5*,0},{9,7}}
(dimension is diffrent)
I need to make new matrixes which include only this rows from matrix M and
matrix N for which firsts elements are the same in both matrix (M and N).
so I need
M1={{1,2},{5,6}}
N1={{1,8},{5,0}}
Elements of matrix are real (not always integer)
Please for help
Peter