How to replace the diagonal entries of a square matrix with entries from a vectore of equal length?
I have an nxn matrix M, and a vector v of length n. I want to swap the diagonal of M with the vector v, without a for loop. Is that possible? Thanks!I have an nxn matrix M, and a vector v of length n. I want to swap the diagonal of M with the vector v, without a for loop. Is that possible? Thanks! I have an nxn matrix M, and a vector v of length n. I want to swap the diagonal of M with the vector v, without a for loop. Is that possible? Thanks! matrix manipulation MATLAB Answers — New Questions