Code covered by the BSD License  

Highlights from
Min/Max selection

Min/Max selection


Bruno Luong (view profile)


07 Apr 2009 (Updated )

Search for k smallest or largest elements in the array

% function [res loc] = maxkmex(list, k)
% Matlab C-Mex
% Purpose: Same as MAXK, i.e.,
% Return in RES the K largest elements of LIST
% LOC is Location of the largest values: RES=LIST(LOC)
% This MEX works on double only, and output RES is unsorted
% Algorithm according to
% Compilation: mex -O -v maxkmex.c
% Author Bruno Luong <>
% Last update: 07/April/2009

error('Mex file not yet compiled. Action: mex -O -v maxkmex.c');

Contact us