diagonal

Returns a vector with the main diagonal of a matrix. Similar to the built-in function diag

Al momento, stai seguendo questo contributo

This file contians a function named "diagonal01" which isolates in a row vector the diagonal of a matrix (square or not), whitout using a loop. It is similar to the Matlab built-in function "diag" when used with one input argument.
For example, the instructions
» A=magic(4); A(end,:)=[], B=diagonal01(A)

Produce

A =
16 2 3 13
5 11 10 8
9 7 6 12
B =
16 11 6

Cita come

Miguel D. B. (2026). diagonal (https://it.mathworks.com/matlabcentral/fileexchange/10324-diagonal), MATLAB Central File Exchange. Recuperato .

Informazioni generali

Compatibilità della release di MATLAB

  • Compatibile con qualsiasi release

Compatibilità della piattaforma

  • Windows
  • macOS
  • Linux
Versione Pubblicato Note della release Action
1.0.0.0