;------------------------------------------------------------ ;------------------------------------------------------------ ;------------------------------------------------------------ ;+ ; @file_comments ; Send back a vector or a matrix constituted of 0 and 1 in alternation ; ; @categories ; Function, Matrix ; ; @param n1 {in}{required} number of elements in the first dimension ; @param n2 {in}{required} number of elements in the second dimension ; ; @returns result ; ; @history Sebastien Masson (smasson\@lodyc.jussieu.fr) ; 1/12/98 ; ; @version $Id$ ; ;- ;------------------------------------------------------------ ;------------------------------------------------------------ ;------------------------------------------------------------ function zero_one, n1,n2 ; compile_opt idl2, strictarrsubs ; CASE N_PARAMS() OF 1:return, findgen(n1) mod 2 2:BEGIN if fix(n1/2) EQ n1/2. then BEGIN ;even number of columns res = findgen(n1+1,n2) mod 2 return, res[0:n1-1, *] ENDIF ELSE return, findgen(n1,n2) mod 2 ;odd number of columns END else: return, report('bad number of arguments') endcase end