Extract Elements From Arrays
Add an Extract Elements from Arrays node to extract one or more elements from a 1-D or multi-dimensional array. Follow these steps:
- Double-click Extract Elements from Arrays in the Tasks list.
- Draw a connector between an array input node, and the Extract Elements from arrays node. Examples of array input include an Array of Values node or a task that produces an array.
- Click the button in the Extract Elements from Array node. The Extract Elements from Array dialog appears, listing the known properties and metadata items from the input.
- In the Indices field, specify one or more zero-based elements to extract from the input array. For 1-D arrays, this is the subscript of the array element. For example, if the array is [1, 2, 3, 4, 5, 6] and you want to extract the third element (with a value of 3), enter an Indices value of 2. See the table below for guidelines on specifying ranges of subscripts.
- Click OK.
For multi-dimensional arrays, specify the 1-D subscript of the array element to extract. For example, suppose that you have an array with three columns and two rows:
1 2 3
4 5 6
To extract the array element in the first column and second row (with a value of 4), enter an Indices value of 3. Array elements are stored in row order in IDL.
Array Subscript Ranges
The following table summarizes the different ways to specify ranges of array subscripts.
Subscript Format |
Description |
[n]
|
A simple subscript, either positive or negative. Positive subscripts are indexed from the beginning of the array, while negative subscripts are indexed from the end (where |
|
Subscript range from This denotes all elements whose subscripts range from the expression |
|
Every The expression |
See Also
Add Tasks to Models, Specify Input Datasets and Task Parameters