Dew Stats Master .NET
Unique Routine
Summary
Finds the unique elements in vector/matrix.

Unit
Statistics

Declaration
Procedure Unique(Src: TMtxVec; Dst: TVec);

Description
Finds and sorts the unique elements in Src vector/matrix array. Sorted values are returned in Dst vector. An exception is raised if Src is Complex. Length and Complex properties of Dst vector are adjusted automatically.
 See Also 
Ranks 
TiedRanks 

Example 1

Collect unique elements from matrix
Uses MtxExpr, Statistics; procedure Example; var m1: Matrix; uvec: Vector; begin m1.SetIt(4,3,false, [ 1,2,3, 4,2,1, 3,2,3, 3,3,1]); Unique(m1,uvec); // uvec elements are [1,2,3,4] end;
#include "MtxVecCpp.h" #include "Math387.hpp" #include "Statistics.hpp" void __fastcall Example(); { Matrix m1; Vector uvec; m1->SetIt(false,OPENARRAY(TSample,(1,2,3, 4,2,1, 3,2,3, 3,3,1))); Unique(m1,uvec); // uvec elements are [1,2,3,4] }
using Dew.Math; using Dew.Stats; using Dew.Stats.Units; namespace Dew.Examples { private void Example() { Matrix m1 = new Matrix(0,0); Vector uvec = new Vector(0); m1.SetIt(4,3,false, new double[] { 1,2,3, 4,2,1, 3,2,3, 3,3,1}); Statistics.Unique(m1,uvec); // uvec elements are [1,2,3,4] } }

Copyright 2008 Dew Research
http://www.dewresearch.com