I have the feeling this is a very basic question, but I can't seem to find the way to solve this easily.
I have imported a set of data from a txt file into a table so the resulting list has the following structure:
{{x1,y1,f1},{x2,y2,f2},...}
I want it to reshape it into this form:
{{{x1,y1},f1},{{x2,y2},f2},...}
I apologize because I know it must be trivial but I haven't found the way yet. I've always had problems manipulating lists in Mathematica so, if anyone has any resource I can use to learn about this it'd be very much appreciated.
Regards
Apply[{{#1, #2}, #3} &, {a, b, c}]
and it should help you. CheckApply
for more details. $\endgroup$reshape = Curry[Replace, {3, 1, 2}][{s_, t_, u_} :> {{s, t}, u}, {1}]
. Then{{x1, y1, f1}, {x2, y2, f2}} // reshape
gives the desired result. $\endgroup$Apply[{{#1, #2}, #3} &, {{x1, y1, f1}, {x2, y2, f2}}, {1}]
$\endgroup$