I've done a program that makes this, in the example attached, you can see how i create an array for each data group, and add it to a 2D array using a shift register when a button is hit. I think it's a good sollution for what you want. You can automatize the button true false state, or set it true every x time.
Hope this helps