changeset 18418:1ad77b3e6bef stable

interp1.m: Demote error to warning about multiple discontinuties (bug #41386). * interp1.m: Demote error to warning about multiple discontinuties (bug #41386). Add %!warning test for new behavior.
author Rik <rik@octave.org>
date Fri, 31 Jan 2014 21:08:15 -0800
parents 71d1a1450365
children 2a45b6b87bee
files scripts/general/interp1.m
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/general/interp1.m	Fri Jan 31 09:21:41 2014 -0800
+++ b/scripts/general/interp1.m	Fri Jan 31 21:08:15 2014 -0800
@@ -212,7 +212,7 @@
     if (have_jumps)
       if (strcmp (method, "linear") || strcmp (method, ("nearest")))
         if (any (jumps(1:nx-2) & jumps(2:nx-1)))
-          error ("interp1: extra points in discontinuities");
+          warning ("interp1: multiple discontinuities at the same X value");
         endif
       else
         error ("interp1: discontinuities not supported for method '%s'", method);
@@ -640,6 +640,7 @@
 %!error <table too short> interp1 (1,1,1, "linear")
 %!error <table too short> interp1 (1,1,1, "*nearest")
 %!error <table too short> interp1 (1,1,1, "*linear")
+%!warning <multiple discontinuities> interp1 ([1 1 1 2], [1 2 3 4], 1);
 %!error <discontinuities not supported> interp1 ([1 1],[1 2],1, "pchip")
 %!error <discontinuities not supported> interp1 ([1 1],[1 2],1, "cubic")
 %!error <discontinuities not supported> interp1 ([1 1],[1 2],1, "spline")