Hello, im having trouble with this matrix (shown below). What im trying to do is make a row vector of all the values along the row number defined by j, except for the main diagonal. So that in effect, each value is taken as it is shown in the matrix, apart from the diagonal values.

in effect what im am trying to command isM = [2 -1 -0.5 0 0 0 0 0;-1 4 -1 0 0 0 0 0; -0.5 0 2 -1 -0.5 0 0 0; 0 -1 -1 4 0 -1 0 0; 0 0 -0.5 0 2 -1 -0.5 0; 0 0 0 -1 -1 4 0 -1; 0 0 0 0 -1 0 3 -1; 0 0 0 0 0 -1 -0.5 3]

for j=1:L

M(j,1:L)

end

so that it misses out the j column.M(j,1: (j-1) && (j+1):L)

where L is defined as the length of the matrix

Any help would be fantastic