MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: matrix problem

  • To: mathgroup at
  • Subject: [mg107114] Re: matrix problem
  • From: Peter Pein <petsie at>
  • Date: Wed, 3 Feb 2010 06:09:38 -0500 (EST)
  • References: <hk93ca$f68$>

Am 02.02.2010 12:47, schrieb Piotr Munik:
> 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

Hi Peter,

1.) do not use reserved function names ("N" in this case) as variables;
this might lead to "surprises".

2.) In[1]:= mM={{1,2},{3,4},{5,6},{7,8}}; mN={{1,8},{5,0},{9,7}};

The following call to Pick[] works on both matrices at once:

In[3]:= {mM1,mN1}=
Out[3]= {{{1,2},{5,6}},{{1,8},{5,0}}}


  • Prev by Date: Re: Re: Normality test
  • Next by Date: Re: Combining InterpolatingFunctions
  • Previous by thread: Re: matrix problem
  • Next by thread: Re: matrix problem