Coyote Graphics Routines

Date: Fri Mar 27 12:14:20 2015

single page | use frames     summary     class     fields     routine details     file attributes


top cgSetUnion


result = cgSetUnion(set_a, set_b [, COUNT=long])

This function is used to find the union between two sets of integers.

One alternative for the cgSetUnion algorithm, provided by Maarten Sneep, is simply this:

superset = [set_a, set_b] union = superset[Uniq(superset, Sort(superset))]

Return value

A vector of values that are found in the combined integer sets.


set_a in required type=integer

A vector of integers.

set_b in required type=integer

A vector of integers.


COUNT out optional type=long

Set this keyword to a named variable containing the number of integers found in the union.


IDL> set_a = [1,2,3,4,5] IDL> set_b = [4,5,6,7,8,9,10,11] IDL> Print, cgSetUnion(set_a, set_b) 1 2 3 4 5 6 7 8 9 10 11

See for other types of set operations.

Author information



David W. Fanning 1645 Sheely Drive Fort Collins, CO 80526 USA Phone: 970-221-0438 E-mail: Coyote's Guide to IDL Programming:


Copyright (c) 2009-2013, Fanning Software Consulting, Inc.


Change History:

Written by: David W. Fanning, November 25, 2009, from code originally supplied to the IDL newsgroup by Research Systems software engineers. Added COUNT keyword. 24 April 2014. DWF.

File attributes

Modification date: Fri Mar 27 11:07:39 2015
Lines: 116
Docformat: rst rst