if the number of columns is fixed you can always add rows to your matrix (inside the loop)
e.g.
while(....).....
new_row =[x y];%new row with values x & y
mat =[mat ; new_row];
of course if you know the number of iterations before the while loop it's more efficient to pre-allocate the matrix