| 
     
      
      
      From: Andy A. <ad...@nc...> - 2005-05-10 22:58:01
       
   | 
The current version does not have this message. What version of octave-forge do you have? Andy  | 
| 
     
      
      
      From: Andy A. <ad...@nc...> - 2005-05-11 14:56:05
       
   | 
Note that this is just a documentation bug. The first parameter is the struct, so the code is correct. Ben Barrowes wrote: Downloaded octave-forge-2004.11.16.tar.gz on May 6th. setfields.m in main/struct of my build trunk has this bug. Ben Andy Adler wrote: >The current version does not have this message. >What version of octave-forge do you have? > >Andy  | 
| 
     
      
      
      From: Ben B. <bar...@al...> - 2005-05-11 15:20:51
       
   | 
OK.
I encountered this because optimset.m has the line 45:
opt = setfields ();
which caused the original setfields.m:
function s = setfields(s,varargin)
if rem(nargin,2) != 1,
      error('setfields: called with odd number of arguments\n') ;
endif
to complain.
nargin==0 should be a valid call to setfields, so maybe some easy fix 
would be:
function s = setfields(s,varargin)
if nargin>0
  if rem(nargin,2) != 1,
        error('setfields: called with even number of arguments\n') ;
   endif
else
    s=struct;
end
Andy Adler wrote:
>Note that this is just a documentation bug. The first
>parameter is the struct, so the code is correct.
>
>Ben Barrowes wrote:
>
>Downloaded octave-forge-2004.11.16.tar.gz on May 6th. setfields.m in
>main/struct of my build trunk has this bug.
>
>Ben
>
>Andy Adler wrote:
>
>  
>
>>The current version does not have this message.
>>What version of octave-forge do you have?
>>
>>Andy
>>    
>>
>
>  
>
-- 
-------------------- Benjamin E. Barrowes -------------------
Los Alamos National Laboratory          bar...@al...
Biophysics Group P-21, MS-D454            Phone:(505)606-0105
Los Alamos, NM 87544                        FAX:(270)294-1268
-------------------------------------------------------------
 | 
| 
     
      
      
      From: Andy A. <ad...@nc...> - 2005-05-12 01:39:15
       
   | 
I've made a change to the CVS to support this. Note,
however, that s= struct() only works in newer versions
of octave (works in 2.9.2 and not in 2.1.42 - I don't
have others lying around to test)
setfields now reads:
    function s = setfields(s,varargin)
    if nargin == 0
      s= struct; % doesn't work on older versions of octave
    elseif rem(nargin,2) != 1,
      error('setfields: expected struct, key1, val1, key2, val2, ...\n') ; 
    endif
            
    for i=1:2:nargin-1
      if ! isstr(varargin{i}) ,
        error('setfields: called with non-string key') ; 
      else
        eval( ['s.',varargin{i},'=varargin{i+1};'] ) ;
        end
      end
    end
>> Ben Barrowes wrote:
OK.
I encountered this because optimset.m has the line 45:
opt = setfields ();
which caused the original setfields.m:
function s = setfields(s,varargin)
if rem(nargin,2) != 1,
      error('setfields: called with odd number of arguments\n') ;
endif
to complain.
nargin==0 should be a valid call to setfields, so maybe some easy fix
would be:
function s = setfields(s,varargin)
if nargin>0
  if rem(nargin,2) != 1,
        error('setfields: called with even number of arguments\n') ;
   endif
else
    s=struct;
end
 | 
| 
     
      
      
      From: Ben B. <bar...@al...> - 2005-05-11 12:51:42
       
   | 
Downloaded octave-forge-2004.11.16.tar.gz on May 6th. setfields.m in main/struct of my build trunk has this bug. Ben Andy Adler wrote: >The current version does not have this message. >What version of octave-forge do you have? > >Andy > > -- -------------------- Benjamin E. Barrowes ------------------- Los Alamos National Laboratory bar...@al... Biophysics Group P-21, MS-D454 Phone:(505)606-0105 Los Alamos, NM 87544 FAX:(270)294-1268 -------------------------------------------------------------  |