changeset 15194:2d5e4d283688

Modified interp1.m file to check whether X has distinct values or not.
author Vivek Dogra <vivek.dogra.iitd@gmail.com>
date Fri, 17 Aug 2012 08:22:30 -0400
parents 8367f326fa29
children 0f0b795044c3
files doc/interpreter/contributors.in scripts/general/interp1.m
diffstat 2 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/doc/interpreter/contributors.in
+++ b/doc/interpreter/contributors.in
@@ -48,6 +48,7 @@
 Bill Denney
 Fabian Deutsch
 Christos Dimitrakakis
+Vivek Dogra
 David M. Doolin
 Carnë Draug
 Pascal A. Dupuis
--- a/scripts/general/interp1.m
+++ b/scripts/general/interp1.m
@@ -168,6 +168,11 @@
     y = y(p,:);
   endif
 
+ ## check whether sample point @var{x} are distinct; give error if not.
+  if (any (diff (x) == 0))
+    error ("interp1: X should have distinct values");
+  endif
+
   starmethod = method(1) == "*";
 
   if (starmethod)