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

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

replace some print by some report in some .pro (continuation) + improvements/corrections of some *.pro headers

  • Property svn:keywords set to Id
File size: 841 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; Function, 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;-
25;
26FUNCTION zero_one, n1,n2
27;
28  compile_opt idl2, strictarrsubs
29;
30   CASE N_PARAMS() OF
31      1:return, findgen(n1) mod 2
32      2:BEGIN
33         if fix(n1/2) EQ n1/2. then BEGIN ;even number of columns
34            res = findgen(n1+1,n2) mod 2
35            return, res[0:n1-1, *]
36         ENDIF ELSE return, findgen(n1,n2) mod 2 ;odd number of columns
37      END
38      else: return,  report('bad number of arguments')
39   endcase
40end
Note: See TracBrowser for help on using the repository browser.