MathGroup Archive 2004

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

Search the Archive

RE : partition of 2D arrray

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49162] RE : [mg49137] partition of 2D arrray
  • From: "Florian Jaccard" <florian.jaccard at eiaj.ch>
  • Date: Tue, 6 Jul 2004 03:33:20 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Lot of possibilities !
For example :

mat = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}, {13, 14, 15, 16}};

In[45]:=
mat /. {(a_)?NumericQ, b_, _, _} -> {a, b}

Out[45]=
{{1, 2}, {5, 6}, {9, 10}, {13, 14}}

In[48]:=
(Take[#1, 2] & ) /@ mat

Out[48]=
{{1, 2}, {5, 6}, {9, 10}, {13, 14}}



F.Jaccard


-----Message d'origine-----
De : Ravinder Kumar B. [mailto:ravi at crest.ernet.in] 
Envoyé : lundi, 5. juillet 2004 10:54
À : mathgroup at smc.vnet.net
Objet : [mg49137] partition of 2D arrray

Dear Friends,
I have a list of 2D data of the following form:
{{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}};
In MatrixForm it is 4x4 matrix.
How do I extract the fisrt two column of the data from the above matrix.
i.e.,
{{1,2},{5,6},{9,10},{13,14}}


-- 
 Regards,                                   Jul 2
    Ravi



         |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
         |           Ravinder Kumar Banyal (SRF),                |
         |          Indian Institute of Astrophysics,            |
         |           Koramangala Bangalore - 560 034. INDIA      |
         | email : banyal at iiap.res.in, ravi at crest.ernet.in       |
         | Ph No : 080 25530672 (IIA)       080 7931972 (Hoskote)|
         |                                     7931952           |
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Philosophers have interpreted the world in various ways, but the point is
to change it. --Karl Marx




  • Prev by Date: Re: partition of 2D arrray
  • Next by Date: AW: partition of 2D arrray
  • Previous by thread: RE : Interpolating function
  • Next by thread: AW: partition of 2D arrray