>  Docs Center  >  Libraries  >  JBIU  >  IS_SORTED
Libraries

IS_SORTED

IS_SORTED

Name


    IS_SORTED

Purpose


    Checks whether an array is already sorted.

Category


    Misc

Calling Sequence


    Result = IS_SORTED(Array)

Inputs


    Array: An array to check.

Example


    IDL> print, is_sorted([0,10,15,25])
      1
    IDL> print, is_sorted([0,15,10,25])
      0

Modification History


    Written by: Jeremy Bailin
    20 May 2011 Initial writing
unction is_sorted, array
eturn, total(abs(sort(array) - lindgen(n_elements(array))),/int) eq 0
nd



© 2024 NV5 Geospatial Solutions, Inc. |  Legal
My Account    |    Contact Us