changeset 8080:9f10a7b28ae3

__add_datasource__.m: fix indexing of varargin
author David Bateman
date Tue, 02 Sep 2008 15:01:18 -0400
parents 082fa7859574
children b1634dd9ebe7
files scripts/ChangeLog scripts/plot/__add_datasource__.m
diffstat 2 files changed, 10 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Tue Sep 02 14:52:28 2008 -0400
+++ b/scripts/ChangeLog	Tue Sep 02 15:01:18 2008 -0400
@@ -1,5 +1,7 @@
 2008-09-02  David Bateman  <dbateman@free.fr>
 
+	* plot/__add_datasource__.m: Fix indexing of varargin.
+
 	* plot/__line__.m: Remove empty clause fof if/then/else test
 	* plot/plot3.m: Correctly plot matrices.
 
--- a/scripts/plot/__add_datasource__.m	Tue Sep 02 14:52:28 2008 -0400
+++ b/scripts/plot/__add_datasource__.m	Tue Sep 02 15:01:18 2008 -0400
@@ -32,17 +32,18 @@
     addproperty (strcat (data{i}, "datasource"), h, "string", "");
   endfor
 
-  i = 1;
+  i = 0;
   newargs = {};
   while (i < numel (varargin))
-    arg = varargin{i++};
-    if (ischar (arg) && length (arg > 1) && strcmpi (arg(2:end), "datasource"))
+    arg = varargin{++i};
+    if (i != numel(varargin) && ischar (arg) &&
+    length (arg > 1) && strcmpi (arg(2:end), "datasource"))
       arg = tolower (arg);
-      val = varargin{i++};
-      if (ischar (val)) 
-	set (h, arg, val);
+      val = varargin{++i};
+      if (ischar (val))
+    set (h, arg, val);
       else
-	error ("%s: expecting data source to be a string", fcn);
+    error ("%s: expecting data source to be a string", fcn);
       endif
     else
       newargs{end + 1} = arg;