# How to select the data in a given way?

Consider the data

data = {{x1,y1,z1},{x2,y2,z2},{x3,y3,z3},{x4,y4,z4},{x5,y5,z5},{x6,y6,z6},...}


with N rows.

It can be divided into N/6 sets of 6 rows. I want to select a subdata obtained from the sets satisfying some specific requirement for 3rd rows of the sets, say data[[3+6*i]][[2]]>10.

Example:

data = {{1,2,3},{1,9,6},{1,12,6},{1,5,6},{1,6,3},{1,5,5},{3,5,6},{1,10,6},{1,8,6},{1,4,6},{1,0,4},{1,3,6}}


The data contains 2 sets of 6 rows. In the first set we have data[[3]][[2]]>10, in the second set we have data[[9]][[2]]<10, and therefore after imposing the criterion data[[3 +6*i]][[2]]>10 we obtain

subdata = {{1,2,3},{1,9,6},{1,12,6},{1,5,6},{1,6,3},{1,5,5}}

• What is the question? You seem to have obtained what you want... Commented Feb 15, 2019 at 17:28
• Is this what you want? Select[Partition[data, 6], #[[3, 2]] > 10 &] Commented Feb 15, 2019 at 17:48
• @march : that's almost what I wanted. I just need to remove partition afterwards. Could you please tell me how to do that? Commented Feb 23, 2019 at 0:46
• Select[Partition[data, 6], #[[3, 2]] > 10 &]~Flatten~1. Commented Feb 26, 2019 at 19:02

partitions = Partition[data, 6];

You can also use undocumented 6-argument form of Partition:
Partition[data, 6, 6, 1, {}, If[{##}[[3, 2]] > 10, {##}, Nothing] &]