for i = 1:10 for j = 1:10 if j <= i, val = 0; else val = 1; end my_matrix(i, j) = val; end; end; disp(my_matrix);