Returns the diagonal elements along two selected dimensions. Input: A Multidimensional input array. dim Contains two number, that selects two dimensions. The diagonal is the diagonal of every A(... dim(1)...dim(2)...) matrix. The result is contracted along dim(2). The default value for dim is dim = [1 2]. Examples: For 2D matrices mmat is identical to the Matlab built-in diag: A = [1 2; 3 4]; C = mdiag(A) C will be [1;4]. For multidimensional arrays: A = repmat([1 2; 3 4],[1 1 3]); B = mdiag(A,[1 2]) B will be an array with dimensions of 2x3: [1 1 1;4 4 4].

Generated on Mon 26-Nov-2018 15:08:42 by