Extracting plot over line data for all time steps

Hello,

I have conducted a multiphase simulation using openfoam. I am trying to extract the volume fraction across a channel (using plot over line). I now want to repeat the same for all time steps and save the data in a matrix where the rows represent the variable in space and the columns represent the variables in time so that I can later process it using matlab or python.