Matrix/
extrac2.pro
extraction of subdomains of matrices;
Even if the subdomain is "pierced" (see the example)
By default, IDL can make extractions of subdomain:
IDL> a=indgen(5,5)
IDL> print, a
0 1 2 3 4
5 6 7 8 9
10 11 12 13 14
15 16 17 18 19
20 21 22 23 24
IDL> print, a[[0,2],3]
15 17
IDL> print, a[[0,2],*]
0 2
5 7
10 12
15 17
20 22
but
IDL> print, a[[0,2],[3,4]]
15 22
while
IDL> print, extrac2(a,[0,2],[3,4])
15 17
20 22
extrac2
Utilities
result = extrac2(array, index1, index2, index3, index4)
Return value
a matrix 1,2,3 or 4d extract from input array
-1 in case of mistake
Parameters
array
in
required
a 1,2,3 or 4 dim input array
index1
in
required
can have 2 forms:
1)a vector containing indexes of lines we want to keep
2)the string '*' if we want to keep all lines.
index2
in
required
the same thing that index1 but for dim 2.
index3
in
required
the same thing that index1 but for dim 3.
index4
in
required
the same thing that index1 but for dim 4.
Examples
I have a dim 2 matrix named A. I want extract a small intersection
matrix 2d of the line 2,3 and 7 and of the column 0 and 1:
IDL> res=extrac2(A,[2,3,7],[0,1])
other ex:
IDL> print, a
a b c
d e f
g h i
IDL> print, extrac2(a,[0,2],[0,2])
a c
g i
Version history
Version
$Id: extrac2.pro 325 2007-12-06 10:04:53Z pinsard $
History
Sebastien Masson (smasson@lodyc.jussieu.fr)
12/1/1999
29/4/1999: correction of a bug and complement of the heading
Known issues
Restrictions
Produced by IDLdoc 2.0.