The Stack Overflow podcast is back! Listen to an interview with our new CEO.
    Post Closed as "off-topic" by Edmund, MarcoB, PlatoManiac, m_goldberg, J. M. will be back soon
2 edited tags
| link
1
source | link

Dividing data into blocks define sizes

I'm pretty sure I should be using BinLists[...] but it doesn't behave quite as I expect. Say I have a list of data : Data = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,...}

I want to be able to chop this data into blocks of a certain size, e.g. {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{..}} for blocks of three, or, {{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16},{...}} for blocks of four

I try using BinLists[Data,3] but this seems to be out of order giving me {{1,2},{3,4,5},{6,7,8},{9,10,11},{12,13,14},...} rather than in the form I described above.

Is there a way to modify BinLists[...] in some way or an alternative that will achieve what I want.

Thanks