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:

- nt_inpaint function y=nt_inpaint(x,w) - weighted interpolation based on correlation structure
- nt_outliers [w,y]=nt_outliers(x,w,thresh,niter) - detect outliers based on weighted correlation structure
- nt_star2 [y,w,ww]=nt_star2(x,thresh,closest,w) - sensor noise suppression

## 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);