diag(.) does not work

diag function works in a wrong way as shown in the figure. How can i fix it?

2 Commenti

What happens when you do,
>> whos diag
whos diag -all

Accedi per commentare.

Risposte (2)

Walter Roberson
Walter Roberson il 27 Ott 2018

1 voto

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 il 27 Ott 2018
Try
clear all
x=[8 1 6;3 5 7;4 9 2]
diag(x)

Prodotti

Tag

Richiesto:

il 27 Ott 2018

Commentato:

il 27 Ott 2018

Community Treasure Hunt

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

Start Hunting!

Translated by