clear all %start with blank slate / empty matrices N=3; M=3; for n=1:N for m=1:M A(n,m)=n*m ; end end A