Message Boards Message Boards

1
|
8155 Views
|
3 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Making a table from two lists

Posted 9 years ago

I'm trying to do something I feel should be rather simple.

list1={1,2,3,4}

list2={11,12,13,14}

SomeFunction[list1,list2]

Output of SomeFunction { {1, 11} , {2, 12}, {3, 13} , {4, 14} } Because I would like to use ListLogLogPlot on the output.

Originally I was trying to plot list1 as the x-values and list2 as the y-values, but I don't think I know the keywords needed to find the appropriate functions.

POSTED BY: Luis Morales
3 Replies
Transpose[{{1, 2, 3, 4} , {11, 12, 13, 14}}]

output

POSTED BY: David Gathercole
Posted 9 years ago

Amazing!!! Now that I think about it, that makes perfect sense lol. Thank you.

POSTED BY: Luis Morales

Or, in this case:

Thread[{{1, 2, 3, 4}, {11, 12, 13, 14}}]

or

MapThread[List, {{1, 2, 3, 4}, {11, 12, 13, 14}}]

or

Partition[Riffle[{1, 2, 3, 4}, {11, 12, 13, 14}], 2]

or

Table[{{1, 2, 3, 4}[[i]], {11, 12, 13, 14}[[i]]}, {i, 4}]

really there are so may ways, I can give you another 10....

POSTED BY: Sander Huisman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract