Error is erased, but you need to fix this code. The code don't make result to your intend.
M = [1 3 2 -4 1 10 -3;0 0 0 -2 0 4 0;0 0 0 -4 1 7 -2;0 0 -3 6 -2 -10 4];
i=2
j=3
[x, y] = size(M); %n is rows and m is columns
submatrix = M([i:x],[1:y]); %creates submatrix of ith row down
column_j = submatrix(:,j); %gives jth column
row = find(column_j,1); %gives row number of first nonzero
l = M(i,:); %gives ith row of M
k = M(row+1,:); %gives row that has nonzero in M
M(i,:) = k
M(j,:) = l
switching:
M = [1 3 2 -4 1 10 -3; 0 0 0 -2 0 4 0 ; 0 0 0 -4 1 7 -2 ; 0 0 -3 6 -2 -10 4];
i=2
j=4
temp = M(j,:)
M(j,:) = M(i,:)
M(i,:) = temp