RE: List Operation ?
- To: mathgroup at smc.vnet.net
- Subject: [mg40231] RE: [mg40204] List Operation ?
- From: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.com>
- Date: Thu, 27 Mar 2003 06:49:17 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
>-----Original Message----- >From: Sunil Jayatilleke [mailto:sunilj at physics.uc.edu] To: mathgroup at smc.vnet.net >Sent: Tuesday, March 25, 2003 8:51 PM >To: mathgroup at smc.vnet.net >Subject: [mg40231] [mg40204] List Operation ? > > > > >I have a list as follows > >list1 = >{{a1,b1,c1,d1,e1,f1},{a2,b2,c2,d2,e2,f2},{............}.............} > >Now I want to do the following > >list2 ={{a1,b1,d1},{a2,b2,d2}......................} > >How can I do that ? > >thanks > >SJ > > In[4]:= list1 = Outer[StringJoin, Characters["abcdef"], ToString /@ Range[5]] // Transpose Out[4]= {{"a1", "b1", "c1", "d1", "e1", "f1"}, {"a2", "b2", "c2", "d2", "e2", "f2"}, {"a3", "b3", "c3", "d3", "e3", "f3"}, {"a4", "b4", "c4", "d4", "e4", "f4"}, {"a5", "b5", "c5", "d5", "e5", "f5"}} In[5]:= list2 = list1[[All, {1, 2, 4}]] Out[5]= {{"a1", "b1", "d1"}, {"a2", "b2", "d2"}, {"a3", "b3", "d3"}, {"a4", "b4", "d4"}, {"a5", "b5", "d5"}} -- Hartmut Wolf