Re: How to extract numbers from list elements with text?

• To: mathgroup at smc.vnet.net
• Subject: [mg70368] Re: [mg70335] How to extract numbers from list elements with text?
• From: gardyloo <gardyloo at mail.wsu.edu>
• Date: Sat, 14 Oct 2006 03:07:27 -0400 (EDT)
• References: <200610130530.BAA01154@smc.vnet.net>

```Hi,

Here is what I would consider a very "cheap" way of doing this
particular task. It won't generalize to many lists of this sort, but I
was curious to see if it worked. It uses the dumb technique of letting
Mathematica treat each of the list elements as expressions to be
multiplied together (so that, for example, the second element in your
list becomes 0.0001 Intensity), and then just divides each resulting
element by "Intensity" and the position of the element in the list. It
might be enough for now, though:

lst = {1 Intensity 0.23523, 2 Intensity 0.00005,

3 Intensity 0.00004}

Flatten[MapIndexed[#1/(#2*Intensity) & , lst]]

{0.23523, 0.00005, 0.00004}

Best of luck!
C.O.

Henning Heiberg-Andersen wrote:
> Hi,
>
> I have a list looking like this:
>
> { 1 Intensity 0.23523,  2 Intensity 0.00005,  3 Intensity 0.00004, ..}
>
> Is there a command which allows extraction of only the last number appearing
> in each element
> of the list?. If not, how can I modify the list elements?
>
> Best regards,
>
> Henning Heiberg-Andersen
>
>
>
>

--
==========================================================
Curtis Osterhoudt
gardyloo at mail.remove_this.wsu.and_this.edu
PGP Key ID: 0x088E6D7A
Please avoid sending me Word or PowerPoint attachments
See http://www.gnu.org/philosophy/no-word-attachments.html
==========================================================

```

• Prev by Date: Re: Re: On order of options to Graphics
• Next by Date: Re: Re: Definition of SE (standard error) in LinearRegress and NonlinearRegress
• Previous by thread: Re: How to extract numbers from list elements with text?
• Next by thread: RE:How to extract numbers from list elements with text?