ARRAY_INDICES
Syntax | Return Value | Arguments | Keywords | Examples | Version History | See Also
The ARRAY_INDICES function converts one-dimensional subscripts of an array into corresponding multi-dimensional subscripts.
This routine is written in the IDL language. Its source code can be found in the file array_indices.pro in the lib subdirectory of the IDL distribution.
Syntax
Result = ARRAY_INDICES(Array, Index [, /DIMENSIONS] )
Return Value
If Index is a scalar, returns a vector containing m dimensional subscripts, where m is the number of dimensions of Array.
If Index is a vector containing n elements, returns an (m x n) array, with each row containing the multi-dimensional subscripts corresponding to that index.
Arguments
Array
An array of any type, whose dimensions should be used in converting the subscripts. If DIMENSIONS is set then Array should be a vector containing the dimensions.
Index
A scalar or vector containing the one-dimensional subscripts to be converted.
Keywords
DIMENSIONS
If this keyword is set, then Array is assumed to be a vector containing the dimensions.
Tip
This keyword is useful when you don't have the actual Array, and want to avoid allocating the array just to find the indices.
Examples
Example 1
This example finds the location of the maximum value of a random 10 by 10 array:
IDL prints:
Example 2
This example is the same as the previous example, but uses the /DIMENSIONS keyword.
IDL prints:
Example 3
This example routine locates the highest point in the example Maroon Bells data set and places a flag at that point.
Enter the following code in the IDL editor:
Save the code as ExARRAY_INDICES.pro, compile it and run it. The following figure displays the output of this example:
|
![]()
|
For a better view of the flag, use the Rotate tool to rotate the surface.
Version History
