findNsmallest

Finds the N smallest values in the input. Very fast.

You are now following this Submission

Example:
x = findNsmallest( [4 4 10 5 3 8], 3)

x =
4 4 3

Written in c, so the operation is fast. Type "mex findNSmallest.c" in matlab before use.

You might need a free compiler if it was not installed with your matlab:
http://www.mathworks.com/support/compilers/R2012b/win64.html

Cite As

Mattias Karlsson (2026). findNsmallest (https://www.mathworks.com/matlabcentral/fileexchange/39727-findnsmallest), MATLAB Central File Exchange. Retrieved .

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.1.0.0

Added example to description

1.0.0.0