%

% Copyright 2017 The MathWorks, Inc.
function dimensions = getAllDimensions(dataSize)
    sz = prod(dataSize);
    dimensions = zeros(sz, numel(dataSize));
    for idx = 1:numel(dataSize)
        dimension = dataSize(idx);
        % get the repeating sequence by multiplying the dimensions before it
        col = repelem((1:dimension)', prod(dataSize(1 : idx-1)), 1);
        % repeat that sequence to fit the number of rows of the matrix
        col = repmat(col, [sz / numel(col), 1]);
        dimensions(:, idx) = col;
    end
end
