Returnsa vector (one-dimensional array) containing the unique elements from another vector.
vec = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5]
vec
:
result = UNIQUE(vec) PRINT, result
1 2 3 4 5
For example, a table called
phone_data
contains information on phone calls made during a three-day period. This table contains eight columns of phone information: the date, time, caller's initials, phone extension, area code of call, number of call, duration, and cost. (For more information on the structure of this table, see the PV-WAVE User's Guide.)dates = UNIQUE(phone_data.DATE)
NOTE: Tables are represented as an array of structures. In this command,phone_data.DATE
represents theDATE
field of the structure calledphone_data
.
dates
that contains a list of the dates on which calls were made:
PRINT, dates
901002 901003 901004
unique_date = UNIQUE(phone_data.DATE)
date_pick = unique_date $ (TVMENU(STRING(unique_date)))
total_cost = QUERY_TABLE(phone_data, $ 'DATE, SUM(COST) Where DATE = ' +$ 'date_pick Group By DATE')