Changeset 15768 for issm/trunk-jpl/src/m/classes/masstransport.m
- Timestamp:
- 08/09/13 10:07:08 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/classes/masstransport.m
r15767 r15768 14 14 requested_outputs = NaN; 15 15 end 16 methods (Static) 17 function obj = loadobj(obj) % {{{ 18 % This function is directly called by matlab when a model object is 19 % loaded. If the input is a struct it is an old version of this class and 20 % old fields must be recovered (make sure they are in the deprecated 21 % model properties) 22 23 if verLessThan('matlab','7.9'), 24 disp('Warning: your matlab version is old and there is a risk that load does not work correctly'); 25 disp(' if the model is not loaded correctly, rename temporarily loadobj so that matlab does not use it'); 26 27 % This is a Matlab bug: all the fields of md have their default value 28 % Example of error message: 29 % Warning: Error loading an object of class 'model': 30 % Undefined function or method 'exist' for input arguments of type 'cell' 31 % 32 % This has been fixed in MATLAB 7.9 (R2009b) and later versions 33 end 34 35 if isstruct(obj) 36 disp('Recovering masstransport from older version'); 37 objstruct = obj; 38 obj = structtoobj(masstransport(),objstruct); 39 end 40 end% }}} 41 end 16 42 methods 17 43 function obj = masstransport(varargin) % {{{ … … 19 45 case 0 20 46 obj=setdefaultparameters(obj); 47 case 1 48 inputstruct=varargin{1}; 49 list1 = properties('masstransport'); 50 list2 = fieldnames(inputstruct); 51 for i=1:length(list1) 52 fieldname = list1{i}; 53 if ismember(fieldname,list2), 54 obj.(fieldname) = inputstruct.(fieldname); 55 end 56 end 21 57 otherwise 22 58 error('constructor not supported');
Note:
See TracChangeset
for help on using the changeset viewer.