That is not possible for the general case where N is not the same as (M-1) -- that is, if the two variables to be incremented do not have the same length.
If the two did have the same length then
m_vals = 2:M;
n_vals = 1:N;
for idx = 1 : length(m_vals)
m = m_vals(idx);
n = n_vals(idx);
X1=X(m,:)-(X(m,n)/X(1,n))*X(1,:);
end
or
for m = 2 : M
n = m - 1;
X1=X(m,:)-(X(m,n)/X(1,n))*X(1,:);
end
or
for m = 2 : M
X1=X(m,:)-(X(m,m-1)/X(1,m-1))*X(1,:);
end