I have a 900x100x100 array of floats called 'data' which is essentially 900 frames of 100x100 pixels. I want to extract 10,000 sequences of 900 values each. These are essentially the time series of the values of each the 10,000 individual pixels.
I have achieved this in what I know is an ugly and horribly inefficient iterative way by doing the following
output = {}
reshapedTensor = Table[data[[;;,i,j]],{i,1,100},{j,1,100}]
Do[AppendTo[output,reshapedTensor[[i,j]]],{i,100},{j,100}]]
where I am essentially walking across the 100x100 frame and pulling out each 900 point sequence and then appending it to the list output.
Yes horrendous, I know, but I found the concept of "levels" in some of the ArrayReshape/Flatten functions confusing and couldn't tell how to apply them here.
I would like to both find the correct functional way to do this and also understand the native functions that reorder data in this sort of way so I can use these better in future.
I suspect it will also be much more performant and easier to read and make sense of.
Thanks much!
Flatten[data, {{2, 3}, {1}}]
do what you want? $\endgroup$