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

struct2str

(tmp_for_tar/dumper/struct2str.m)


Function Synopsis

s = struct2str(mat)	

Help text

 s = struct2str(mat)          - Convert a structure to octave code

 Converts an octave structure to a string that evaluates to that object.

  See also any2m, any2str, cmpany, list2str, mat2str.

 Last modified: August 2001



Cross-Reference Information

This function calls

Listing of function file tmp_for_tar/dumper/struct2str.m

## s = struct2str(mat)          - Convert a structure to octave code
## 
## Converts an octave structure to a string that evaluates to that object.
##
##  See also any2m, any2str, cmpany, list2str, mat2str.


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

function s = struct2str(mat)	

  s = sprintf('struct( ...\n'); % )

  fc = fields(mat) ;			% Field cell 
  for i = 1:length(fc),
    % fn = deblank(fc(i,:)) ;
    fn = deblank(nth(fc,i)) ;
    fd = getfield(mat,fn);		% Field data 
    
    s = [s,sprintf(" '%s' , %s ",fn,any2str(fd))];
    
    if i<length(fc) , s = [s,sprintf(',...\n')] ; end
    
  end

  s = [s,sprintf('...\n)')];

endfunction

Produced by oct2html on Tue Aug 7 17:33:07 2001
Cross-Directory links are: ON