Changeset 9078


Ignore:
Timestamp:
07/19/11 16:36:57 (14 years ago)
Author:
Mathieu Morlighem
Message:

better way to call model template (cannot cast object to struct without matlab complaining

Location:
issm/trunk/src/m
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/m/classes/model.m

    r9077 r9078  
    372372                         end
    373373                 end% }}}
     374                 function temp = template() % {{{
     375
     376                         %Get default fields
     377                         md=model(0);
     378                         modelprops=properties('model');
     379
     380                         %build output
     381                         temp=struct();
     382                         for i=1:length(modelprops),
     383                                 temp.(modelprops{i})=md.(modelprops{i});
     384                         end
     385
     386                 end% }}}
    374387         end
    375388         methods
  • issm/trunk/src/m/model/marshall.m

    r8967 r9078  
    1717
    1818%automatically marshall model md, using template information available from an empty model class.
    19 template=struct(model(0));
     19template=model.template();
    2020fields=fieldnames(template);
    2121for i=1:length(fields),
Note: See TracChangeset for help on using the changeset viewer.