ArraySlice

Returns a subset of the elements in an array.

Syntax:

ArraySlice array, fist1, last1, [first2, last2, [first3, last4, [first4, last4, [first5, last5]]]] )

Parameters:

(a) array: specifies an array.

(i) first1: subscript (dimension 1) of first element to include.

(i) last1: subscript (dimension 1) of last element to include.

(i) first2: subscript (dimension 2) of first element to include.

(i) last2: subscript (dimension 2) of last element to include.

(i) first3: subscript (dimension 3) of first element to include.

(i) last3: subscript (dimension 3) of last element to include.

(i) first4: subscript (dimension 4) of first element to include.

(i) last4: subscript (dimension 4) of last element to include.

(i) first5: subscript (dimension 5) of first element to include.

(i) last5: subscript (dimension 5) of last element to include.

Returns:

(a)  returns some or all of elements in array.

 

ArraySlice returns a new array containing a subset or all of the elements in the supplied array. The elements of the returned array are determined by the range or ranges passed in parameters 2 through 11.

The subscript ranges supplied in parameters 2 through 11 must be supplied in pairs with one pair per dimension of the passed in array. You can use  the value -1 for any subscript to indicate the last subscript of a given dimension.

Note: like array bracket syntax subscripts are zero based.

Usually, when the first and last parameter for a given dimension have the same value, the dimension is removed from the returned array. Specifying the same values for first and last subscript still influences the contents of the return array and the function will always return an array of at least one element.

Example:
  ; Create an array for this example
  info = FileInfoToArray( "*.wbt", 0)
  
  ; Create a rank 1 array of file names
  ;   File names start with the second row
  ;   of he first column of the returned array.
  names = ArraySlice(info, 1, -1, 0, 0)  
  files = ArrayItemize(names, @lf)
  Message('WIL Scripts In Current Folder', files) 
  Exit
See Also:

Arrays, ArrayFileGet, ArrayFileGetCsv, ArrayFilePut, ArrayFilePutCsv, ArrayFromStr, ArrayInsert, Arrayize, ArrayItemize, ArrayLocate, ArrayRedim, ArrayRemove, ArrayReverse, ArraySort, ArraySwapElements, ArrayToStr, ArrDimension, ArrInfo, ArrInitalize, Drop