Maptitude GISDK Help

CompareArrays()

Summary

Compares two arrays, element by element.

 

Changes

Added to Version 2014.

 

Syntax

ret_array = CompareArrays (array arr1, array arr2, array options)

 

Argument Contents
Arr1 The first of the two arrays to compare
Arr2 The second of the two arrays to compare

 

Option Type Contents
Compare Macro String Name of a macro that will be called to compare elements in the array when comparing
Return Array Boolean If "True", the ArrayOfMatches array will be returned; the default is "False"
Return Booleans Boolean If "True", the return values in the returned ArrayOfMatches will be 1 for True and 0 for False as the result of the element by element comparison; the default is "False"

 

Returns

An options array with the following possible options:

 

Element Type Contents
Match Boolean 1, if all the values in the arrays are the same, otherwise 0
ArrayOfMatches Array Array of values with the results of the element by element comparison; only returned when the "Return Array" input option is "True".

 

Notes

 

Examples

Arr1 = {1, 2, 3, 4, 5}

Arr2 = {1, 2, 4, 4, 5}

Ret = CompareArrays(Arr1, Arr2, {{"Return Array", "True"}})

// Ret.Match = "False"

// Ret.ArrayOfMatches = {0, 0, -1, 0, 0}

Ret = CompareArrays(Arr1, Arr2, {{"Return Array", "True"}, {"Return Booleans", "True"})

// Ret.Match = "False"

// Ret.ArrayOfMatches = {1, 1, 0, 1, 1}

 

Arr1 = {1, 2, 3, 4, 5}

Arr2 = {1, 2, 3, 4, 5, 6} Ret = CompareArrays(Arr1, Arr2,

{{"Return Array", "True"}})

// Ret.Match = "False"

// Ret.ArrayOfMatches = {0, 0, 0, 0, 0, 1}

 

Error Codes

Error Type Meaning
Error Either Arr1 or Arr2 is null

 

See Also

Function Summary
SortArray() Sorts the elements of an array

 

 

 

©2025 Caliper Corporation www.caliper.com