invperm.m

来自「物流分析工具包。Facility location: Continuous mi」· M 代码 · 共 19 行

M
19
字号
function inva = invperm(a)
%INVPERM Inverse permutation.
%  inva = invperm(a)
%     a = permutation vector of the integers 1 to length(a)
%
% See also RANDPERM

% Copyright (c) 1994-2006 by Michael G. Kay
% Matlog Version 9 13-Jan-2006 (http://www.ie.ncsu.edu/kay/matlog)

% Input Error Checking ****************************************************
if any(sort(a(:)') ~= 1:length(a(:)))
   error('Input argument not a permutation vector.')
end
% End (Input Error Checking) **********************************************

inva(a) = 1:length(a);
inva = reshape(inva,size(a));

⌨️ 快捷键说明

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