diag(.) does not work

13 次查看(过去 30 天)
Hye-Jin Kim
Hye-Jin Kim 2018-10-27
评论: Stephen23 2018-10-27
diag function works in a wrong way as shown in the figure. How can i fix it?

回答(2 个)

Walter Roberson
Walter Roberson 2018-10-27
I suspect you accidentally assigned zeros to a variable named diag, so your call is indexing rather than invoking the function.

madhan ravi
madhan ravi 2018-10-27
Try
clear all
x=[8 1 6;3 5 7;4 9 2]
diag(x)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by