comparison scripts/statistics/distributions/nbinrnd.m @ 11472:1740012184f9

Use uppercase for variable names in error() strings to match Info documentation. Only m-files done.
author Rik <octave@nomad.inbox5.com>
date Sun, 09 Jan 2011 21:33:04 -0800
parents fe3c3dfc07eb
children fd0a3ac60b0e
comparison
equal deleted inserted replaced
11471:994e2a93a8e2 11472:1740012184f9
35 35
36 if (nargin > 1) 36 if (nargin > 1)
37 if (!isscalar(n) || !isscalar(p)) 37 if (!isscalar(n) || !isscalar(p))
38 [retval, n, p] = common_size (n, p); 38 [retval, n, p] = common_size (n, p);
39 if (retval > 0) 39 if (retval > 0)
40 error ("nbinrnd: n and p must be of common size or scalar"); 40 error ("nbinrnd: N and P must be of common size or scalar");
41 endif 41 endif
42 endif 42 endif
43 endif 43 endif
44 44
45 if (nargin == 4) 45 if (nargin == 4)
46 if (! (isscalar (r) && (r > 0) && (r == round (r)))) 46 if (! (isscalar (r) && (r > 0) && (r == round (r))))
47 error ("nbinrnd: r must be a positive integer"); 47 error ("nbinrnd: R must be a positive integer");
48 endif 48 endif
49 if (! (isscalar (c) && (c > 0) && (c == round (c)))) 49 if (! (isscalar (c) && (c > 0) && (c == round (c))))
50 error ("nbinrnd: c must be a positive integer"); 50 error ("nbinrnd: C must be a positive integer");
51 endif 51 endif
52 sz = [r, c]; 52 sz = [r, c];
53 53
54 if (any (size (n) != 1) 54 if (any (size (n) != 1)
55 && ((length (size (n)) != length (sz)) || any (size (n) != sz))) 55 && ((length (size (n)) != length (sz)) || any (size (n) != sz)))
56 error ("nbinrnd: n and p must be scalar or of size [r, c]"); 56 error ("nbinrnd: N and P must be scalar or of size [R, C]");
57 endif 57 endif
58 58
59 elseif (nargin == 3) 59 elseif (nargin == 3)
60 if (isscalar (r) && (r > 0)) 60 if (isscalar (r) && (r > 0))
61 sz = [r, r]; 61 sz = [r, r];
62 elseif (isvector(r) && all (r > 0)) 62 elseif (isvector(r) && all (r > 0))
63 sz = r(:)'; 63 sz = r(:)';
64 else 64 else
65 error ("nbinrnd: r must be a positive integer or vector"); 65 error ("nbinrnd: R must be a positive integer or vector");
66 endif 66 endif
67 67
68 if (any (size (n) != 1) 68 if (any (size (n) != 1)
69 && ((length (size (n)) != length (sz)) || any (size (n) != sz))) 69 && ((length (size (n)) != length (sz)) || any (size (n) != sz)))
70 error ("nbinrnd: n and p must be scalar or of size sz"); 70 error ("nbinrnd: N and P must be scalar or of size SZ");
71 endif 71 endif
72 elseif (nargin == 2) 72 elseif (nargin == 2)
73 sz = size(n); 73 sz = size(n);
74 else 74 else
75 print_usage (); 75 print_usage ();