Creating a vector from the diagonal values of a square matrix

93 views (last 30 days)
Hello,
Does anybody know how I can read the diagonal values of a square matrix and create a vector (1:n) from those values?
Cheers,
Cyrus

Accepted Answer

Ahmet Cecen
Ahmet Cecen on 30 Jul 2014
vector=diag(matrix);
check help diag for more detailed information.

More Answers (0)

Categories

Find more on Operating on Diagonal Matrices in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!