[Index for tmp_for_tar/vrml.doc] [Return to Master Index]

setfield

(tmp_for_tar/vrml.doc/setfield.m)


Function Synopsis

s = setfield(s,...)

Help text

        s = setfield(s,'key1',value1,...)

 Sets s.key1 = value1,  s.key2 = value2, ... and returns s.

 For m****b compatibility and flexibility.

 See also cmpstruct, fields, rmfield, isstruct, getfield, isfield,
 struct. 

 Last modified: January 2000



Listing of function file tmp_for_tar/vrml.doc/setfield.m

##        s = setfield(s,'key1',value1,...)
## 
## Sets s.key1 = value1,  s.key2 = value2, ... and returns s.
## 
## For m****b compatibility and flexibility.
## 
## See also cmpstruct, fields, rmfield, isstruct, getfield, isfield,
## struct. 
## 

## Author:        Etienne Grossmann  <etienne@isr.ist.utl.pt>
## Last modified: January 2000

function s = setfield(s,...)
va_start() ; 
nargin-- ;
while nargin-- ,
  tmp = va_arg() ;
  if ! isstr(tmp) ,
    printf('struct: called with non-string key\n') ; 
    tmp
    keyboard
  else
    if ! nargin-- ,
      printf('struct: called with odd number of arguments\n') ; 
      keyboard
    else
      value = va_arg() ;
      eval( ['s.',tmp,'=value;'] ) ;
    end
  end
end

Produced by oct2html on Sat Dec 2 19:08:39 2000
Cross-Directory links are: ON