Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Extract numbers from list' topicStudent Support Forum > General > "Extract numbers from list"

< Previous CommentHelp | Reply To Comment | Reply To Topic
Author Comment/Response
Peter Pein
10/24/12 06:21am

Hi,

there are several ways to achieve this. Here are some of them:

In[1]:= mylist = {{x, y}, {c, v}};

In[2]:= mylist[[All, 1]]

Out[2]= {x, c}

In[3]:= First[Transpose[mylist]]

Out[3]= {x, c}

In[4]:= First /@ mylist

Out[4]= {x, c}

In[5]:= mylist /. {a_?AtomQ, ___} :> a

Out[5]= {x, c}

Peter

URL: ,

Subject (listing for 'Extract numbers from list')
Author Date Posted
Extract numbers from list 215 10/23/12 4:25pm
Re: Extract numbers from list Bill Simpson 10/23/12 7:28pm
Re: Extract numbers from list Peter Pein 10/24/12 06:21am
< Previous CommentHelp | Reply To Comment | Reply To Topic