Changeset 8401


Ignore:
Timestamp:
05/24/11 07:44:15 (14 years ago)
Author:
Mathieu Morlighem
Message:

Added struct cast: only public properties should be used, otherwise it errors out

File:
1 edited

Legend:

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

    r8400 r8401  
    369369                 % But if we don't keep the old properties here, they would not be
    370370                 % recovered when the model is loaded
     371                 % KEEP IN CHRONOLOGICAL ORDER (OLDER FIRST)
    371372                 drag;
    372373                 p;
     
    375376                 n;
    376377                 melting;
    377                  melting_rate;
    378                  accumulation_rate;
    379378                 accumulation;
    380379                 type;
     
    596595                 end
    597596                 %}}}
     597                 function mdstruct=struct(md) % {{{1
     598                         mdstruct=struct();
     599                         modelprops=properties(md);
     600
     601                         for i=1:length(modelprops),
     602                                 mdstruct.(modelprops{i})=md.(modelprops{i});
     603                         end
     604                 end
     605                 %}}}
    598606                 function md=setdefaultparameters(md) % {{{1
    599607                 %SETDEFAULTPARAMETERS - plug default parameters onto model
Note: See TracChangeset for help on using the changeset viewer.