function dataFlat = flattenData(numberTimeSteps, dimensions, data)
    if isscalar(dimensions) 
        % Inport is NOT matrix, i.e., it has dimension n where n>=1
        dataFlat = data;
    else 
        % Inport is [n_1 n_2 ... n_i] where n_i>=1 and i>=2
        dataFlat = reshape(data,[prod(dimensions) numberTimeSteps]);
    end