octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [changeset] property value not paired with name in __add_datasource_


From: Ben Abbott
Subject: Re: [changeset] property value not paired with name in __add_datasource__.m
Date: Mon, 01 Sep 2008 09:24:33 -0400


On Sep 1, 2008, at 9:06 AM, Ben Abbott wrote:

The script __add_datasource__ does not preserve the property values.

I'm confused as to how __add_datasource__ is intended to work. Is this behavior correct?

If yours works properly (different, I assume), perhaps our sources are out of sync?

Ben

I'm presently unable to pull from jwe's archive :-(

To apply David's patch I edited the sources myself. My archive is now a bit of a mess :-(

In any event, I have a solution (I think). The functioning code for *my* __add_datasource__.m is below. I've modified line 37. It was "while (i < numel (varargin))".

David, the test plot you suggested works now. Is my inferred solution proper?

 21 function newargs = __add_datasource__ (fcn, h, data, varargin)
 22
 23   if (nargin < 3)
 24     error ("internal error");
 25   endif
 26
 27   if (ischar (data))
 28     data = {data};
 29   endif
 30
 31   for i = 1 : numel (data)
 32     addproperty (strcat (data{i}, "datasource"), h, "string", "");
 33   endfor
 34
 35   i = 1;
 36   newargs = {};
 37   while (i <= numel (varargin))
 38     arg = varargin{i++};
39 if (ischar (arg) && length (arg > 1) && strcmpi (arg(2:end), "datasource"))
 40       arg = tolower (arg);
 41       val = varargin{i++};
 42       if (ischar (val))
 43         set (h, arg, val);
 44       else
 45         error ("%s: expecting data source to be a string", fcn);
 46       endif
 47     else
 48       newargs{end + 1} = arg;
 49     endif
 50   endwhile
 51 endfunction

Ben



reply via email to

[Prev in Thread] Current Thread [Next in Thread]