Changeset 450 for trunk/src/struct2xml.m


Ignore:
Timestamp:
Jun 12, 2012, 12:27:42 AM (12 years ago)
Author:
sommeria
Message:

various bugs repaired

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/struct2xml.m

    r42 r450  
    2424fieldnames=fields(Object);
    2525for ilist=1:length(fieldnames)
    26    eval(['val=Object.' fieldnames{ilist} ';'])
     26   val=Object.(fieldnames{ilist});
    2727   if isstruct(val)
    2828      [t,uid]=add(t,root_uid,'element',fieldnames{ilist});
     
    6060           end
    6161       end
     62 elseif iscell(val)
     63      siz=size(val);
     64      if length(siz)<=2 %do not translate cell matrices with more than 2 indices
     65          separator='   '; %mark the separation of columns
     66          for iline=1:siz(1)
     67                val_str=cell2mat(cell2tab(val(iline,:),' & ')); % produce a line string with column separator ' & '
     68                [t,new_uid]=add(t,uid,'element',key);
     69                if siz(1)>1
     70                    t = attributes(t,'add',new_uid,'i',num2str(iline));
     71                end
     72                [t]=add(t,new_uid,'chardata',val_str);
     73          end
     74      end
    6275 end   
Note: See TracChangeset for help on using the changeset viewer.