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