function extract, array, p1, p2, p3, p4
;
;NAME:
;	extract
;PURPOSE:
;	Extract a portion of a 1-D or 2-D array
;
;	A "replacement" since IDL Ver 2 does not
;	have it and IDL Ver 1 did.
;INPUT:
;	array	- Input array
;	--- For 1-D Arrays
;	p1	- starting indicie
;	p2	- number of elements to extract
;	---- For 2-D arrays
;	p1	- starting indicie for first dimension
;	p2	- starting indicie for second dimemsion
;	p3	- number of elements in the first
;		  dimension to extrac
;	p4	- number of elements in the second
;		  dimension to extract
;OUTPUT:
;	Returns	- Subset of input vector
;HISTORY:
;	Written Aug-91 by M.Morrison
;-
;
if (n_params(0) eq 3) then begin	;1-D array
    ist1 = p1
    n1   = p2
    ien1 = ist1 + n1 -1
    out = array(ist1:ien1)
end else begin				;2-D array
    ist1 = p1
    n1   = p3
    ist2 = p2
    n2   = p4
    ien1 = ist1 + n1 -1
    ien2 = ist2 + n2 - 1
    out = array(ist1:ien1, ist2:ien2)
end
;
return, out
end
