Skip to content

Instantly share code, notes, and snippets.

@koistya
Last active December 10, 2015 03:38
Show Gist options
  • Select an option

  • Save koistya/4375826 to your computer and use it in GitHub Desktop.

Select an option

Save koistya/4375826 to your computer and use it in GitHub Desktop.
Grabs top unique 'n' elements from a vector or matrix
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