[2] | 1 | ;+ |
---|
| 2 | ; |
---|
[231] | 3 | ; @file_comments |
---|
| 4 | ; extraction of subdomains of matrices; |
---|
[136] | 5 | ; Even if the subdomain is "pierced" (see the example) |
---|
[133] | 6 | ; By default, IDL can make extractions of subdomain: |
---|
[2] | 7 | ; |
---|
[231] | 8 | ; IDL> a=indgen(5,5) |
---|
| 9 | ; IDL> print, a |
---|
[2] | 10 | ; 0 1 2 3 4 |
---|
| 11 | ; 5 6 7 8 9 |
---|
| 12 | ; 10 11 12 13 14 |
---|
| 13 | ; 15 16 17 18 19 |
---|
| 14 | ; 20 21 22 23 24 |
---|
[231] | 15 | ; IDL> print, a[[0,2],3] |
---|
[2] | 16 | ; 15 17 |
---|
[231] | 17 | ; IDL> print, a[[0,2],*] |
---|
[2] | 18 | ; 0 2 |
---|
| 19 | ; 5 7 |
---|
| 20 | ; 10 12 |
---|
| 21 | ; 15 17 |
---|
| 22 | ; 20 22 |
---|
[133] | 23 | ; but |
---|
[231] | 24 | ; IDL> print, a[[0,2],[3,4]] |
---|
[2] | 25 | ; 15 22 |
---|
[133] | 26 | ; while |
---|
[231] | 27 | ; IDL> print, extrait(a,[0,2],[3,4]) |
---|
[2] | 28 | ; 15 17 |
---|
| 29 | ; 20 22 |
---|
| 30 | ; |
---|
| 31 | ; |
---|
[133] | 32 | ; you better use extrac2 |
---|
[2] | 33 | ; |
---|
[133] | 34 | ; @obsolete |
---|
[2] | 35 | ; |
---|
[231] | 36 | ; @categories |
---|
[157] | 37 | ; Utilities |
---|
[2] | 38 | ; |
---|
[231] | 39 | ; @param tab {in}{required} |
---|
[136] | 40 | ; a 1,2,3 or 4 dim table |
---|
[2] | 41 | ; |
---|
[231] | 42 | ; @param indicex {in}{required} |
---|
[136] | 43 | ; can have 2 forms: |
---|
| 44 | ; 1)a vector containing indexes of lines we want to keep |
---|
| 45 | ; 2)the string '*' if we want to keep all lines. |
---|
[2] | 46 | ; |
---|
[231] | 47 | ; @param indicey {in}{required} |
---|
[136] | 48 | ; the same thing that indicex but for dim 2. |
---|
[2] | 49 | ; |
---|
[231] | 50 | ; @param indicez {in}{required} |
---|
[136] | 51 | ; the same thing that indicex but for dim 3. |
---|
[231] | 52 | ; |
---|
| 53 | ; @param indicet {in}{required} |
---|
[136] | 54 | ; the same thing that indicex but for dim 4. |
---|
[2] | 55 | ; |
---|
[231] | 56 | ; @returns |
---|
[136] | 57 | ; a matrix 1,2,3 or 4d extract from tab |
---|
[231] | 58 | ; -1 in case of mistake |
---|
[2] | 59 | ; |
---|
[231] | 60 | ; @examples |
---|
| 61 | ; I have a dim 2 matrix named A. I want extract a small intersection |
---|
[136] | 62 | ; matrix 2d of the line 2,3 and 7 and of the column 0 and 1: |
---|
[231] | 63 | ; |
---|
[136] | 64 | ; IDL> res=extrait(A,[2,3,7],[0,1]) |
---|
[2] | 65 | ; |
---|
[136] | 66 | ; other ex: |
---|
[231] | 67 | ; IDL> print, a |
---|
[136] | 68 | ; a b c |
---|
| 69 | ; d e f |
---|
| 70 | ; g h i |
---|
[231] | 71 | ; IDL> print, extrait(a,[0,2],[0,2]) |
---|
[136] | 72 | ; a c |
---|
| 73 | ; g i |
---|
[231] | 74 | ; |
---|
[238] | 75 | ; @history |
---|
| 76 | ; Sebastien Masson (smasson\@lodyc.jussieu.fr) |
---|
[136] | 77 | ; 12/1/1999 |
---|
| 78 | ; 29/4/1999: correction of a bug and complement of the heading |
---|
[2] | 79 | ; |
---|
[238] | 80 | ; @version |
---|
| 81 | ; $Id$ |
---|
[133] | 82 | ; |
---|
[2] | 83 | ;- |
---|
[231] | 84 | ; |
---|
[2] | 85 | FUNCTION extrait, tab, indicex, indicey, indicez, indicet |
---|
[114] | 86 | ; |
---|
| 87 | compile_opt idl2, strictarrsubs |
---|
| 88 | ; |
---|
[133] | 89 | case n_params() of |
---|
| 90 | 0:return, extrac2() |
---|
| 91 | 1:return, extrac2(tab) |
---|
| 92 | 2:return, extrac2(tab, indicex) |
---|
| 93 | 3:return, extrac2(tab, indicex, indicey) |
---|
| 94 | 4:return, extrac2(tab, indicex, indicey, indicez) |
---|
| 95 | 5:return, extrac2(tab, indicex, indicey, indicez, indicet) |
---|
| 96 | endcase |
---|
[2] | 97 | end |
---|