Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: complicated list selector

  • To: mathgroup at smc.vnet.net
  • Subject: [mg98449] Re: [mg98415] complicated list selector
  • From: "David Park" <djmpark at comcast.net>
  • Date: Fri, 10 Apr 2009 04:52:12 -0400 (EDT)
  • References: <14418506.1239271591099.JavaMail.root@n11>

data = {{11, {121, 122}}, {21, {221, 222}}, {31, {321, 322}}};

{First[#], Part[#, 2, 2]} & /@ data
{{11, 122}, {21, 222}, {31, 322}}

David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/  

From: summer [mailto:summertan at hotmail.com] 

I have the following list

data = {  {11, {121, 122}},   {21, {221, 222}},  {31, {321, 322}} };

>From each sublist, I want to extract the first element and the second
element of the second sub-sub-list that is:

wanted_result={  {11, 122},   {21, 222},   {31, 322}   }

I tried 

data[[All, {1, {2,1}}]] 

but it gives me error.

What is the right selector ?




  • Prev by Date: Re: complicated list selector
  • Next by Date: Re: Efficient construction of a correlation matrix
  • Previous by thread: Re: complicated list selector
  • Next by thread: Re: complicated list selector