No, all the dimensions of a matrix must be explicitly defined. What I often do in those cases is pre-define a cell array,
with a conservatively large N. Then, as the loop runs, accumulate the data in a sequence of cells,
Later, you can just assemble the cells into a matrix with,
and the empty cells will be ignored.