Creating a vector from the diagonal values of a square matrix

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

 採用された回答

Ahmet Cecen
Ahmet Cecen 2014 年 7 月 30 日

0 投票

vector=diag(matrix);
check help diag for more detailed information.

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeOperating on Diagonal Matrices についてさらに検索

質問済み:

2014 年 7 月 30 日

回答済み:

2014 年 7 月 30 日

Community Treasure Hunt

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

Start Hunting!

Translated by