diag(.) does not work

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

2 comentarios

Matt J
Matt J el 27 de Oct. de 2018
What happens when you do,
>> whos diag
Stephen23
Stephen23 el 27 de Oct. de 2018
whos diag -all

Iniciar sesión para comentar.

Respuestas (2)

Walter Roberson
Walter Roberson el 27 de Oct. de 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 el 27 de Oct. de 2018

1 voto

Try
clear all
x=[8 1 6;3 5 7;4 9 2]
diag(x)

Categorías

Productos

Etiquetas

Preguntada:

el 27 de Oct. de 2018

Comentada:

el 27 de Oct. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by