~ubuntu-branches/debian/sid/octave3.0/sid

« back to all changes in this revision

Viewing changes to scripts/time/eomday.m

  • Committer: Bazaar Package Importer
  • Author(s): Rafael Laboissiere
  • Date: 2009-04-28 15:17:35 UTC
  • mfrom: (6.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090428151735-gm59wmfcmwec3f9e
Tags: 1:3.0.5-3
debian/in/PACKAGE.postinst: Add -verbose option when calling 'pkg
rebuild' in octave and redirect stdin from /dev/null.  This is just to
help debugging the hang up on the mipsel buildd when installing
octave3.0 for building other packages (Bug#524745).

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
## -*- texinfo -*-
20
20
## @deftypefn {Function File} {@var{e} =} eomday (@var{y}, @var{m})
21
21
## Return the last day of the month @var{m} for the year @var{y}.
22
 
## @seealso{datenum, datevec, weekday}
 
22
## @seealso{datenum, datevec, weekday, eomdate}
23
23
## @end deftypefn
24
24
 
25
25
## Author: pkienzle <pkienzle@users.sf.net>
33
33
  endif
34
34
 
35
35
  eom = [31, 28, 31, 30 ,31, 30, 31, 31, 30, 31, 30, 31];
36
 
  e = eom(m);
 
36
  e = reshape (eom(m), size (m));
37
37
  e += (m == 2) & (mod (y, 4) == 0 & (mod (y, 100) != 0 | mod (y, 400) == 0));
38
38
 
39
39
endfunction
49
49
%!assert(eomday(1:3,1:3),[31,28,31])
50
50
%!assert(eomday(1:2000,2)',datevec(datenum(1:2000,3,0))(:,3))
51
51
%!assert([1900:1999](find(eomday(1900:1999,2*ones(1,100))==29)),[1904,1908,1912,1916,1920,1924,1928,1932,1936,1940,1944,1948,1952,1956,1960,1964,1968,1972,1976,1980,1984,1988,1992,1996])
 
52
%!assert(eomday([2004;2005], [2;2]), [29;28])
52
53
# demos
53
54
%!demo
54
55
%! y = 1900:1999;