ind2vec.m

来自「data description toolbox 1.6 单类分类器工具包」· M 代码 · 共 35 行

M
35
字号
function v=ind2vec(i)%IND2VEC Convert indices to vectors.%%	Syntax%%	  vec = ind2vec(ind)%%	Description%%	  IND2VEC and VEC2IND allow indices to be represented%	  either by themselves, or as vectors containing a 1 in the%	  row of the index they represent.%%	  IND2VEC(IND) takes one argument,%	    IND - Row vector of indices.%	  and returns sparse matrix of vectors, with one 1 in%	  each column, as indicated by IND.%%	Examples%%	  Here four indices are defined and converted to vector%	  representation.%%	    ind = [1 3 2 3]%	    vec = ind2vec(ind)%%	See also VEC2IND.% Mark Beale, 2-15-96.% Copyright 1992-2000 The MathWorks, Inc.% $Revision: 1.1.1.1 $vectors = length(i);v = sparse(i,1:vectors,ones(1,vectors));

⌨️ 快捷键说明

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