selcol.m

来自「这是一个关于盲源分离独立成分分析方法(ICA)的软件包」· M 代码 · 共 26 行

M
26
字号
function newMatrix = selcol (oldMatrix, maskVector);

% newMatrix = selcol(oldMatrix, maskVector);
%
% Selects the columns of the matrix that marked by one in the given vector.
% The maskVector is a column vector.
%
% This function is needed by PCAMAT

% 15.3.1998

if size (maskVector, 1) ~= size (oldMatrix, 2),
  error ('The mask vector and matrix are of uncompatible size.');
end

numTaken = 0;

for i = 1 : size (maskVector, 1),
  if maskVector (i, 1) == 1,
    takingMask (1, numTaken + 1) = i;
    numTaken = numTaken + 1;
  end
end

newMatrix = oldMatrix (:, takingMask);

⌨️ 快捷键说明

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