Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

A file consists out of (x,y,z) data and I need the z-values arranged like this:



y=data[[All,2]]; z = data[[All, 3]];

I get the dimensions of the array: {idimx,idimy}. But how can I now arrange it's elements? Thanks a lot.

share|improve this question
Use Partition ? – b.gatessucks Sep 12 '12 at 16:54
thanks, you were right, Partition does the job – Harald Sep 12 '12 at 18:49
up vote 1 down vote accepted
data = Thread[Join[{Tuples[{Range[3], Range[0, 9]}], Range[30]}]] /. {{a_, b_}, c_} -> {a, b, c}
y = data[[All, 2]];
idimy = Length@Position[y, 0];
idimx = Length@data/idimy;
zp = Partition[data[[All, 3]], idimx]

Mathematica graphics



data = ....
zp = Split[data, #1[[2]] < #2[[2]] &][[All, All, 3]]
share|improve this answer
ah, Partition is the key... Thanks a lot – Harald Sep 12 '12 at 18:48
@Harald there are easier ways. See edit – Dr. belisarius Sep 12 '12 at 19:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.