find_target.m

来自「模式识别工具箱,希望对大家有用!」· M 代码 · 共 35 行

M
35
字号
%FIND_TARGET extract the indices of the target and outlier objects
%
%   [I1,I2] = find_target(a)
%
% Give the indices of the objects labelled 'target' and 'outlier' in
% the index vectors I1 and I2 respectively.

% Copyright: D. Tax, R.P.W. Duin, davidt@ph.tn.tudelft.nl
% Faculty of Applied Physics, Delft University of Technology
% P.O. Box 5046, 2600 GA Delft, The Netherlands

function [I1,I2] = find_target(a)

if isa(a,'dataset')
  [l,lablist] = dataset(a);
else
  [l,lablist] = renumlab(a);
end

I1 = find(l == strmatch('target',lablist));
if isempty(I1)
   warning('Cannot find target objects in dataset.');
end
if (nargout>1)
   if isempty(strmatch('outlier',lablist))
     I2 = [];
   else 
     I2 = find(l == strmatch('outlier',lablist));
   end
%   if isempty(I2)
%      warning('Cannot find outlier objects in dataset.');
%   end
end

⌨️ 快捷键说明

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