blkm2vc.m

来自「matlab实现主成分分析PAC神经网络的程序」· M 代码 · 共 23 行

M
23
字号
function vc = blkM2vc(M, blkS)%blkM2vc  Reshaping of a block-matrix into a matrix of vectors%% The matrix  M  consists of blocks of size blkS = [r c]% Each  r by c  block of the matrix  M  is converted into% a  rc by 1 vector and placed as a column of the matrix  vc[rr cc] = size(M) ;r = blkS(1) ; c = blkS(2) ;if  (rem(rr, r) ~= 0) | (rem(cc, c) ~= 0)  error('blocks do not fit into matrix')endnr = rr/r ; nc = cc/c ; rc = r*c ;vc = zeros(rc, nr*nc);for ii = 0:nr-1   vc(:, (1:nc)+ii*nc) = reshape(M((1:r)+ii*r, :), rc, nc) ;end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?