changeset 31533:c154cc05cd1f stable

mean.m: Improve clarity and performance of input validation (bug #63410) * mean.m: Use function all() explicitly in if statement conditionals.
author Rik <rik@octave.org>
date Thu, 24 Nov 2022 06:12:23 -0800
parents 84ac10326a79
children 5fdfd21ce7c9 4b80982e0af8
files scripts/statistics/mean.m
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/statistics/mean.m	Thu Nov 24 15:06:16 2022 +0100
+++ b/scripts/statistics/mean.m	Thu Nov 24 06:12:23 2022 -0800
@@ -157,7 +157,7 @@
 
     ## Two numeric input arguments, dimensions given.  Note scalar is vector!
     dim = varargin{1};
-    if (! (isvector (dim) && dim > 0 && rem (dim, 1) == 0))
+    if (! (isvector (dim) && all (dim > 0) && all (rem (dim, 1) == 0)))
       error ("mean: DIM must be a positive integer scalar or vector");
     endif