source: trunk/SRC/Matrix/zero_one.pro @ 133

Last change on this file since 133 was 133, checked in by navarro, 18 years ago

english and nicer header (1)

  • Property svn:executable set to *
File size: 1.2 KB
Line 
1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5; @file_comments
6; Send back a vector or a matrix constituate of 0 and 1 in alternation
7;
8; @categories function, matrixes
9;
10; @param n1 {in}{required} number of elements in the first dimension
11; @param n2 {in}{required} numbre of elements in the second dimension
12;
13; @returns resultat
14;
15; @history Sebastien Masson (smasson@lodyc.jussieu.fr)
16;                       1/12/98
17;
18; @version $Id$
19;
20;-
21;------------------------------------------------------------
22;------------------------------------------------------------
23;------------------------------------------------------------
24function zero_one, n1,n2
25;
26  compile_opt idl2, strictarrsubs
27;
28   CASE N_PARAMS() OF
29      1:return, findgen(n1) mod 2
30      2:BEGIN
31         if fix(n1/2) EQ n1/2. then BEGIN ;even number of columns
32            res = findgen(n1+1,n2) mod 2
33            return, res[0:n1-1, *]
34         ENDIF ELSE return, findgen(n1,n2) mod 2 ;odd number of columns
35      END
36      else: return,  report('bad number of arguments')
37   endcase           
38end
Note: See TracBrowser for help on using the repository browser.