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

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

improvements/corrections of some *.pro headers

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