LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
matlab
lib
kpctoolbox
basic
minpos.m
1
function pos=minpos(v,n)
2
% pos = MINPOS(v)
3
% Position of maxima in vector v
4
% pos = MAXPOS(v,n)
5
% Position of n largest elements in vector v
6
%
7
% Copyright (c) 2012-2022, Imperial College London
8
% All rights reserved.
9
if nargin<2, n=1; end
10
11
if
n==1
12
[~,pos] = min(v);
13
else
14
[~,pos] = sort(v,
'ascend'
);
15
pos = pos(1:n);
16
end
17
18
end
Generated by
1.9.8