By default all arrays in MATLAB are dynamic; they expand in size when you access out of the current array bounds. Try:



a = [1, 2; 3, 4];
a(5,2) = 7