Coyote Graphics Routines

Date: Fri Mar 27 12:14:20 2015

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


top cgSetDifference


result = cgSetDifference(set_a, set_b [, COUNT=integer] [, NORESULT=NORESULT] [, POSITIONS=integer] [, /SUCCESS])

This function is used to find the difference between two sets of integers. In other words, the function will find the values that are in Set A but are missing in Set B.

Return value

A vector of values that are found in set_a but are missing in set_b.


set_a in required type=integer

A vector of integers.

set_b in required type=integer

A vector of integers.


COUNT out optional type=integer

This keyword contains the number of elements in the difference vector.

NORESULT in optional

Set this keyword to a value that will be returned from the function if no difference between the two sets of numbers is found. By default, set_a.

POSITIONS out optional type=integer

An output keyword that will return the positions or locations in A of the values not found in B.

SUCCESS out optional type=boolean

This keyword is set to 1 if an difference was found, and to 0 otherwise.


Here is how to use this program:

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

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 and POSITIONS keywords. Liam Steele, 13 Dec 2012. Defined values for COUNT and POSITIONS when there is no overlap in the vectors. 14 Dec 2012. LS.

File attributes

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