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

Last change on this file since 371 was 371, checked in by pinsard, 16 years ago

improvements of headers (alignments of IDL prompt in examples)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.2 KB
RevLine 
[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;
[371]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
[371]15;   IDL> print, a[[0,2],3]
[2]16;            15      17
[371]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
[371]24;   IDL> print, a[[0,2],[3,4]]
[2]25;            15      22
[133]26; while
[371]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;
[371]64;   IDL> res=extrait(A,[2,3,7],[0,1])
[2]65;
[136]66; other ex:
[371]67;   IDL> print, a
[136]68; a b c
69; d e f
70; g h i
[371]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;-
84FUNCTION extrait, tab, indicex, indicey, indicez, indicet
[114]85;
86  compile_opt idl2, strictarrsubs
87;
[133]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
[2]96end
Note: See TracBrowser for help on using the repository browser.