source: trunk/SRC/Obsolete/extrait.pro @ 163

Last change on this file since 163 was 163, checked in by navarro, 18 years ago

header improvements : type of parameters and keywords, default values, spell checking + idldoc assistant (IDL online_help)

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