📄 ind2vec.m
字号:
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.7 $vectors = length(i);v = sparse(i,1:vectors,ones(1,vectors));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -