diagonal

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

이 제출물을 팔로우합니다

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

인용 양식

Miguel D. B. (2026). diagonal (https://kr.mathworks.com/matlabcentral/fileexchange/10324-diagonal), MATLAB Central File Exchange. 검색 날짜: .

카테고리

Help CenterMATLAB Answers에서 Operating on Diagonal Matrices에 대해 자세히 알아보기

일반 정보

MATLAB 릴리스 호환 정보

  • 모든 릴리스와 호환

플랫폼 호환성

  • Windows
  • macOS
  • Linux
버전 퍼블리시됨 릴리스 정보 Action
1.0.0.0