;+ ; Copy the data from the from_index location to the to_index location. Anything in ; to_index is lost. This uses the value of !g.line. If it is set (1) ; then the array of line data (!g.s) is used, otherwise the array of ; continuum data (!g.c) is used. The contents of from_index remain ; unchanged by this operation. ; ; @param from_index {in}{required}{type=integer} The index to copy ; values from. ; ; @param to_index {in}{required}{type=integer} The index to copy the ; values to. ; ; @examples ; Copy the contents of location 0 to location 10. Then copy the ; contents of 9 to location 0. ;
; copy, 0, 10 ; copy, 9, 0 ;; ; @uses set_data_container ; ; @version $Id: copy.pro,v 1.5 2005/05/09 18:27:44 bgarwood Exp $ ;- PRO copy, from_index, to_index compile_opt idl2 if n_params() ne 2 then begin message,'Usage: copy, from_index, to_index',/info return endif ; if from=to the do nothing if from_index eq to_index then return ; valid from_index - to_index is checked in set_data_container if (!g.line) then begin if (from_index gt n_elements(!g.s) or from_index lt 0) then begin message, string((n_elements(!g.s)-1),format='("index must be >= 0 and <= ",i2)') return endif set_data_container, !g.s[from_index], index=to_index endif else begin if (from_index gt n_elements(!g.c) or from_index lt 0) then begin message, string((n_elements(!g.c)-1),format='("index must be >= 0 and <= ",i2)') return endif set_data_container, !g.c[from_index], index=to_index endelse return END