/usr/share/psychtoolbox-3/PsychProbability/UniqueAndN.m is in psychtoolbox-3-common 3.0.9+svn2579.dfsg1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | function [b,n] = UniqueAndN(in)
% [uniques,n] = uniqueen(input)
%
% returns the unique elements in input (sorted) and
% the number of times the item ocurred
%
% DN 2008
in = sort(in); % Necessary for the trick below to work
[b,i,j] = unique(in);
d = diff([0; j(:); max(j)+1]);
inds = find(d);
n = inds(2:end)-inds(1:end-1);
|