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

Last change on this file since 372 was 325, checked in by pinsard, 17 years ago

modification of some headers (+some corrections) to prepare usage of the new idldoc

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