1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mathematica - turning two lists into an array

  1. Mar 9, 2009 #1
    Hi

    I need to turn two lists in the form {a1,a2,a3...} {b1,b2,b3...}
    into {{a1,b1},{a2,b2},{a3,b3}..}

    I've looked everywhere on the Wolfram website and the best i found was:

    Riffle[{list1},{list2}] which gives me {a1,b1,a2,b2,a3,b3}

    does anyone know the function to use?

    Thanks
     
  2. jcsd
  3. Mar 27, 2011 #2
    Hi,
    Maybe this:
    Transpose[{{a1, a2, a3}, {b1, b2, b3}}]
     
  4. Mar 27, 2011 #3

    Mapes

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    Equivalently, {{a1, a2, a3}, {b1, b2, b3}}TR. (The transpose symbol comes from hitting Esc, tr, Esc.)
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Mathematica - turning two lists into an array
  1. Function and array (Replies: 26)

Loading...