Changeset 133 for trunk/SRC/Matrix/make_selection.pro
- Timestamp:
- 07/07/06 11:57:27 (18 years ago)
- Location:
- trunk/SRC/Matrix
- Files:
-
- 1 added
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/Matrix/make_selection.pro
r132 r133 1 ; $Id$2 ;-------------------------------------------------------------3 1 ;+ 4 ; NAME:5 ; MAKE_SELECTION (function)6 2 ; 7 ; PURPOSE:8 ; 3 ; file_comments 4 ; Convert an array of selected values to an index 9 5 ; array that identifies the selected values in a list 10 6 ; or data array. 11 7 ; 12 ; CATEGORY: 13 ; Tools 8 ; categories tools 9 ; 10 ; @param NAMES {in}{required} A list or array of values to choose from 14 11 ; 15 ; CALLING SEQUENCE: 16 ; index = MAKE_SELECTION(NAMES,SELNAMES [,keywords]) 12 ; @param SELNAMES {in}{required} A list of selected values 17 13 ; 18 ; INPUTS: 19 ; NAMES -> A list or array of values to choose from 20 ; 21 ; SELNAMES -> A list of selected values 22 ; 23 ; KEYWORD PARAMETERS: 24 ; ONLY_VALID -> Return only indices of found values. Values not 14 ; @keyword ONLY_VALID Return only indices of found values. Values not 25 15 ; found are skipped. Default is to return 1 index value for 26 16 ; each SELNAME, which is -1 if SELNAME is not contained in … … 29 19 ; at all. 30 20 ; 31 ; REQUIRED ->Normally, MAKE_SELECTION will return indices for21 ; @keyword REQUIRED Normally, MAKE_SELECTION will return indices for 32 22 ; all values that are found, simply ignoring the selected 33 23 ; values that are not in the NAMES array (although an error … … 35 25 ; -1 as soon as a selected value is not found. 36 26 ; 37 ; QUIET ->Suppress printing of the error message if a27 ; @keyword QUIET Suppress printing of the error message if a 38 28 ; selected value is not found (the error condition will 39 29 ; still be set). 40 30 ; 41 ; OUTPUTS: 42 ; A (long) array with indices to reference the selected values 31 ; @returns A (long) array with indices to reference the selected values 43 32 ; in the NAMES array. 44 33 ; 45 ; SUBROUTINES: 46 ; 47 ; REQUIREMENTS: 48 ; 49 ; NOTES: 50 ; If the NAMES array contains multiple entries of the same value, 34 ; @restrictions If the NAMES array contains multiple entries of the same value, 51 35 ; only the index to the first entry will be returned. 52 36 ; … … 55 39 ; (See example below) 56 40 ; 57 ; EXAMPLE: 58 ; names = [ 'Alfred','Anton','Peter','John','Mary'] 59 ; index = MAKE_SELECTION(names,['Peter','Mary']) 60 ; print,index 61 ; ; prints 2 4 41 ; @examples names = [ 'Alfred','Anton','Peter','John','Mary'] 42 ; index = MAKE_SELECTION(names,['Peter','Mary']) 43 ; print,index 44 ; ; prints 2 4 62 45 ; 63 ; vals = indgen(20)64 ; index = MAKE_SELECTION(vals,[9,-5,8,7,7,8,9])65 ; print,index66 ; ; prints 9 -1 8 7 7 8 946 ; vals = indgen(20) 47 ; index = MAKE_SELECTION(vals,[9,-5,8,7,7,8,9]) 48 ; print,index 49 ; ; prints 9 -1 8 7 7 8 9 67 50 ; 68 ; index = MAKE_SELECTION(vals,[9,-5,8,7,7,8,9],/ONLY_VALID)69 ; print,index70 ; ; prints 9 8 7 7 8 951 ; index = MAKE_SELECTION(vals,[9,-5,8,7,7,8,9],/ONLY_VALID) 52 ; print,index 53 ; ; prints 9 8 7 7 8 9 71 54 ; 72 ; index = MAKE_SELECTION(vals,[9,-5,8,7,7,8,9],/REQUIRED)73 ; print,index74 ; ; prints -155 ; index = MAKE_SELECTION(vals,[9,-5,8,7,7,8,9],/REQUIRED) 56 ; print,index 57 ; ; prints -1 75 58 ; 59 ; @history mgs, 28 Aug 1998: VERSION 1.00 60 ; mgs, 29 Aug 1998: - changed behaviour and added ONLY_VALID keyword 76 61 ; 77 ; MODIFICATION HISTORY: 78 ; mgs, 28 Aug 1998: VERSION 1.00 79 ; mgs, 29 Aug 1998: - changed behaviour and added ONLY_VALID keyword 62 ; @version $Id$ 80 63 ; 81 64 ;-
Note: See TracChangeset
for help on using the changeset viewer.