changeset 23512:22fd2ad85218 stable

interp1.m: Return NA for all columns which are out of bounds (bug #51030). * interp1.m: Propagate EXTRAP value to all columns, not just first column, when xi is out of bounds.
author Rik <rik@octave.org>
date Thu, 18 May 2017 08:09:08 -0700
parents 2f90ac754550
children 4396af814c6a 22ed4204b2b7
files scripts/general/interp1.m
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/general/interp1.m	Thu May 11 12:02:44 2017 -0700
+++ b/scripts/general/interp1.m	Thu May 18 08:09:08 2017 -0700
@@ -377,13 +377,14 @@
     maxx = max (x(1), x(nx));
 
     xi = reshape (xi, szx);
-    outliers = xi < minx | ! (xi <= maxx); # this even catches NaNs
+    outliers = (xi < minx) | ! (xi <= maxx);  # this even catches NaNs
     if (size_equal (outliers, yi))
       yi(outliers) = extrap;
       yi = reshape (yi, szx);
-    elseif (! isvector (yi))
+    elseif (! isscalar (yi))
       yi(outliers, :) = extrap;
     else
+      warning ("interp1: Unreachable state.  Please submit data that produced this warning to bugs.octave.org");
       yi(outliers.') = extrap;
     endif