Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Lists as databases' topicStudent Support Forum > General > "Lists as databases"

Next Comment >Help | Reply To Topic
Author Comment/Response
Leo Ditolaghi
10/05/10 00:23am

Hi all, noob Mathematica question:

If I have two lists, how do I determine at which indices does the 1st list match the elements of the second, and then use these matching indices to extract corresponding columns in the 1st list (sort of a simulated database join)? I.e.,

x = {{"hello", 27},
{"bye", 30},
{"hello", 54},
{"seeya", 100},
{"hi", 9}}

y = {"hello", "hi"}

I wish to produce z, where y defines which elements of x to extract:

z = {27,54,9}

Thanks in advance,

Leo

URL: ,

Subject (listing for 'Lists as databases')
Author Date Posted
Lists as databases Leo Ditolaghi 10/05/10 00:23am
Re: Lists as databases yehuda ben-s... 10/06/10 1:43pm
Re: Re: Lists as databases Leo Ditolaghi 10/06/10 3:52pm
Re: Re: Re: Lists as databases Peter Pein 10/07/10 07:26am
Re: Lists as databases TomD 10/07/10 07:31am
Re: Re: Lists as databases Leo Ditolaghi 10/07/10 4:54pm
Re: Lists as databases Leo Ditolaghi 10/07/10 10:13am
Re: Re: Lists as databases TomD 10/07/10 6:51pm
Re: Re: Re: Lists as databases Leo Ditolaghi 10/08/10 11:48am
Next Comment >Help | Reply To Topic