unique

From DavinciWiki
Jump to: navigation, search


64-bit SafeYes

Description

Find unique elements or sub-arrays in a VAL or TEXT object.

Arguments and Return Values

Arguments: A 1-D or 2-D numeric array or TEXT array and another optional array of either type by which elements are selected.

Return Value: A subset of the VAL or TEXT object.

Usage

Syntax: unique(object=VAL or TEXT, by=VAL or TEXT)

'object' - A numeric or TEXT array

'by' - A numeric or TEXT array

The idea behind the function unique() is to throw out all repeats of a value or string.

You may select elements from an object based on unique values of another array using 'by'.

Examples

dv> a_TEXT
Text Buffer with 10 lines of text
   1: doug
   2: peter
   3: paul
   4: bishop
   5: samuel
   6: mimi
   7: terwilliger
   8: doug
   9: paul
  10: samuel

dv> a_VAL
1x10x1 array of float, bsq format [40 bytes]
0.466058
0.0444799
0.883557
0.442786
0.413890
0.163879
0.189026
0.485825
0.0379430
0.297025

dv> unique(a_TEXT)
Text Buffer with 7 lines of text
   1: doug
   2: peter
   3: paul
   4: bishop
   5: samuel
   6: mimi
   7: terwilliger

dv> unique(a_TEXT, by=a_VAL)
Text Buffer with 7 lines of text
   1: bishop
   2: doug
   3: doug
   4: mimi
   5: peter
   6: samuel
   7: samuel

DavinciWiki Mini-Nav Bar

Contents


Contact Developers

  • davinci-dev [AT] mars.asu.edu

All other topics

  • See navigation on the left

Related Functions

Recent Core Changes

Modified On: 10-01-2009

Personal tools