>  Docs Center  >  Libraries  >  Mankoff  >  ARRCONCAT
Libraries

ARRCONCAT

ARRCONCAT

Name


ARRCONCAT

Purpose


      Concatenate onto an array. This utility makes it easier to build an N+1
      dimensional array from a bunch of n-dimensional arrays. For example, the common
      case of X=[X,42] can be done with this function, but it becomes more useful
      when concatenating 2D or 3D arrays together into 3D or 4D arrays.

Category


Utility, Arrays

Calling Sequence


Result = ARRCONCAT( ARR, ADD )

Inputs


  ARR: A scalar or array of 1,2, or 3 dimensions
  ADD: A scalar or array of 1,2, or 3 dimensions

Keywords


  KEEP1D: Set (when appending two 1D arrays) to keep it 1D, and
          simply grow the length ([a,b] rather than [[[a],[b]]])

Outputs


  An array that is based on ARR but has ADD concatenated to it.

Restrictions


  Little error checking is done. ARR and ADD must be logically concatenatable.
  Doesn't work for 5D or higher arrays

Example


  r = arrconcat( x, 43 ) ; returns [43]
  r = arrconcat( 42, 43 ) ; returns [42,43]
  x = [40,41] & y = [42,43]
  r = arrconcat( x, y ) ; r is 2x2
  print, r
      40 41
      42 43
  r = arrconcat( r, [44,45] ) ; r is 2x3
  print, r
      40 41
      42 43
      44 45
  x = [40,41] & y = [42,43]
  r = arrconcat( x, y, /KEEP1D ) ; r is 1x4
  print, r
      40 41 42 43

Modification History


  Written by: Ken Mankoff. 2007-07-10



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