[Index for tmp_for_tar/struct] [Return to Master Index]

struct

(tmp_for_tar/struct/struct.m)


Function Synopsis

s = struct(...)

Help text

       s = struct(key1,val1,...)

 Returns a struct such that s.key1 = val1 , s.key2 = val2 ...

 For m****b compatibility.

 See also fields, getfield, setfield, rmfield, isfield, isstruct,
 cmpstruct, struct_size. 

 Last modified: January 2000



Listing of function file tmp_for_tar/struct/struct.m

##       s = struct(key1,val1,...)
## 
## Returns a struct such that s.key1 = val1 , s.key2 = val2 ...
##    
## For m****b compatibility.
##
## See also fields, getfield, setfield, rmfield, isfield, isstruct,
## cmpstruct, struct_size. 

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

function s = struct(...)
va_start() ; 
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;"]) ;
      eval(["s.",tmp,"=va_arg();"]) ;
    end
  end
end

Produced by oct2html on Wed Aug 8 19:47:02 2001
Cross-Directory links are: ON