Mercurial > octave-antonio
comparison scripts/statistics/distributions/betarnd.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 | be55736a0783 |
children | fd0a3ac60b0e |
comparison
equal
deleted
inserted
replaced
11471:994e2a93a8e2 | 11472:1740012184f9 |
---|---|
35 | 35 |
36 if (nargin > 1) | 36 if (nargin > 1) |
37 if (!isscalar(a) || !isscalar(b)) | 37 if (!isscalar(a) || !isscalar(b)) |
38 [retval, a, b] = common_size (a, b); | 38 [retval, a, b] = common_size (a, b); |
39 if (retval > 0) | 39 if (retval > 0) |
40 error ("betarnd: a and b must be of common size or scalar"); | 40 error ("betarnd: A and B 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 ("betarnd: r must be a positive integer"); | 47 error ("betarnd: 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 ("betarnd: c must be a positive integer"); | 50 error ("betarnd: C must be a positive integer"); |
51 endif | 51 endif |
52 sz = [r, c]; | 52 sz = [r, c]; |
53 | 53 |
54 if (any (size (a) != 1) | 54 if (any (size (a) != 1) |
55 && (length (size (a)) != length (sz) || any (size (a) != sz))) | 55 && (length (size (a)) != length (sz) || any (size (a) != sz))) |
56 error ("betarnd: a and b must be scalar or of size [r,c]"); | 56 error ("betarnd: A and B must be scalar or of size [R,C]"); |
57 endif | 57 endif |
58 elseif (nargin == 3) | 58 elseif (nargin == 3) |
59 if (isscalar (r) && (r > 0)) | 59 if (isscalar (r) && (r > 0)) |
60 sz = [r, r]; | 60 sz = [r, r]; |
61 elseif (isvector(r) && all (r > 0)) | 61 elseif (isvector(r) && all (r > 0)) |
62 sz = r(:)'; | 62 sz = r(:)'; |
63 else | 63 else |
64 error ("betarnd: r must be a positive integer or vector"); | 64 error ("betarnd: R must be a positive integer or vector"); |
65 endif | 65 endif |
66 | 66 |
67 if (any (size (a) != 1) | 67 if (any (size (a) != 1) |
68 && (length (size (a)) != length (sz) || any (size (a) != sz))) | 68 && (length (size (a)) != length (sz) || any (size (a) != sz))) |
69 error ("betarnd: a and b must be scalar or of size sz"); | 69 error ("betarnd: A and B must be scalar or of size SZ"); |
70 endif | 70 endif |
71 elseif (nargin == 2) | 71 elseif (nargin == 2) |
72 sz = size(a); | 72 sz = size(a); |
73 else | 73 else |
74 print_usage (); | 74 print_usage (); |