Vectorized Diagonal of any Multi-Dimensional Matrix

버전 1.0.0.0 (3.23 KB) 작성자: Darin Koblick
Given an N-D matrix, this routine will return the diagonal elements of any two dimensions
다운로드 수: 257
업데이트 날짜: 2015/1/17

라이선스 보기

Suppose you have a matrix which was generated by the following MATLAB command:
>> ND = repmat(diag(1:3),[1 1 2 2 1 2]);
The size of this matrix is found to be: [3 3 2 2 1 2]

This routine can return the diagonal terms of this matrix simply by specifying the row dimension and the column dimension of the 2-D plane of interest:
>> dND = diagND(ND,1,2);

The resulting Matrix, dND, has the following size [1 3 2 2 1 2] and the expected solution of:
[1 2 3] across dimensions 3 through 6.

인용 양식

Darin Koblick (2024). Vectorized Diagonal of any Multi-Dimensional Matrix (https://www.mathworks.com/matlabcentral/fileexchange/49067-vectorized-diagonal-of-any-multi-dimensional-matrix), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2013b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Operating on Diagonal Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0