Home > NoiseTools > nt_unique.m

nt_unique

PURPOSE ^

[C,IA,IC,N] = nt_unique(A, varargin) - unique with counts

SYNOPSIS ^

function [C,IA,IC,N] = nt_unique(A, varargin)

DESCRIPTION ^

[C,IA,IC,N] = nt_unique(A, varargin) - unique with counts

  N: number of occurrences

 See unique for definition of other variables.
 
 NoiseTools

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [C,IA,IC,N] = nt_unique(A, varargin)
0002 %[C,IA,IC,N] = nt_unique(A, varargin) - unique with counts
0003 %
0004 %  N: number of occurrences
0005 %
0006 % See unique for definition of other variables.
0007 %
0008 % NoiseTools
0009 
0010 [Asorted,iSort]=sortrows(A);
0011 [~,iReverse]=sort(iSort);
0012 [C,IA,IC]=unique(Asorted,varargin{:});
0013 p=find([1;diff(IC);1]);  
0014 N=diff(p); 
0015 
0016 IA=iSort(IA);
0017 IC=IC(iReverse);

Generated on Sat 29-Apr-2023 17:15:46 by m2html © 2005