MathGroup Archive 2004

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

Search the Archive

Re: Extracting elements of lists


On Jan 9, 2004, at 5:20 AM, sashan wrote:

> Hi
>
> I'm trying to extract a elements from a list and return another list
> with those elements. I've tried doing it using a while loop and
> recursion and haven't been able to do it.
>
> The list I'm working with is a list of lists where each inner list
> contains 4 elements. Example:
> {{0, 1, 0, 0}, {0.04, 1, -0.0008, 0}, {0.1, 0.999987, -0.00499995,
>      0}, {0.15, 0.999937, -0.0112494, 0}, {0.18, 0.999869, -0.0161983,
> 0},....
>

Try

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

I suggest looking at Part in the documentation.

Regards,

Ssezi


  • Prev by Date: Graphics / cosmetics
  • Next by Date: Re: finding eigenvalues
  • Previous by thread: Extracting elements of lists
  • Next by thread: Re: Extracting elements of lists