>  Docs Center  >  Libraries  >  Beaumont  >  ARRGEN




  This function is similar to (and an extension of) built-in
  functions like indgen, findgen, etc. It creates an array given the
  first element, last element, and step size. It can create arrays
  which increase/decrease by constant amounts at each element, or
  that increase/decrease by constant factors at each element.



Calling Sequence

  result = ARRGEN(first, max, [step, /log, nstep = nstep])


  first: The first element in the array. The data type of the result
        will be the same as first
  last: The (approximate) last element in the array. If there are not
        an integer number of elements between first and last, then
        one extra element will be added. In other words, either the
        last element will have the value "last", or the last two
        elements will bracket the value "last."
  step: The difference between adjacent array elements. If /LOG is
        not set, this must be a positive number, and specifies the
        additive offset between adjacent elements. If /LOG is set,
        this must be a number greater than one. It specifies the
        multiplicative offset between adjacent elements.

Keyword Parameters

  LOG: If set, then the array values increase or decrease by a
      multiplicative (instead of additive) constant at each step. In
      otherwords, the logarithm of the elements are evenly spaced.
  NSTEP: Set to specifiy the number of elements in the array, instead
        of the step size. This overrides step.


  The created array.


  IDL> print, arrgen(1, 5, 1)
          1 2 3 4 5
  IDL> print, arrgen(1, 10, 4)
          1 5 9 13
  IDL> print, arrgen(5, 1, 2)
          5 3 1
  IDL> print, arrgen(1, 1000, 10, /log)
      1 10 100 1000
  IDL> print, arrgen(1.0D, 5, 1)
      1.0000000 2.0000000 3.0000000 4.0000000 5.0000000

Modification History

  July 2009: Written by Chris Beaumont
  July 2009: Added nstep keyword

© 2023 NV5 Geospatial |  Legal
My Account    |    Contact Us