For this, Part
(shorthand [[]]
) is your friend. Using
data = RandomReal[{0, 10}, {20, 5}];
as the data set, you can extract multiple columns as follows:
data[[All, {x, y}]]
where x
is the x-column and y
is the y-column. Note, x
can equal y
and even be larger than y
. Their values are only constrained by the number of columns, with one exception: negative indices are treated as starting from the end of the list, not the beginning like positive indices. To get multiple data sets, you have to be a little creative,
data[[All, {1, #}]]& /@ Range[2, Length@data[[1]]]