MATLAB: Create a diagonal matrix from a vector

MATLABmatrixmatrix manipulation

Hello,
Consider a 1×7 vector.
How can I create a 7×7 matrix where the main diagonal elements are zeros (m(i,i)=0) and m(i,j)=m(j,i)?
where,
i=1,…,7 the rows index
j=1,…,7 the columns index

Best Answer

m(1)=0;
toeplitz(m)