Last active
December 10, 2015 03:38
-
-
Save koistya/4375826 to your computer and use it in GitHub Desktop.
Grabs top unique 'n' elements from a vector or matrix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function output = topunique(nums, n) | |
| %TOPUNIQUE вытаскивает 'n' уникальных чисел сверху из списк | |
| % вытащить уникальные числа | |
| output = unique(nums(:), 'stable'); | |
| % ограничить их кол-во до 'n' элементов | |
| output = output(1:min(n, length(output))); | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment