Re: matrix problem
- To: mathgroup at smc.vnet.net
- Subject: [mg107107] Re: matrix problem
- From: dh <dh at metrohm.com>
- Date: Wed, 3 Feb 2010 06:08:21 -0500 (EST)
- References: <hk93ca$f68$1@smc.vnet.net>
Hi, you want all rows of m1 that have the same starting number as some row of m2. We may translate this directly into Mathematica code: m1 = {{1, 2}, {3, 4}, {5, 6}, {7, 8}}; m2 = {{1, 8}, {5, 0}, {9, 7}}; Select[m1, MemberQ[m2[[All, 1]], #[[1]]] &] Daniel Piotr Munik wrote: > Dear Math Group, > > 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 > >