MATLAB: Create a row vector of the diagonal elements from matrix.

matrix extractionmatrix values into row vector

So I am knew to MATLAB and have a question reguarding matricies.
I'm wondeirng how to create a row vector from the diagonal values (Top left to bottom right) from a matrix (I'm using a 6×6 matrix).
Any advice would be much appreaciated.
Thanks,
Ben.

Best Answer

Meet the diag function!