Last change
on this file since 11224 was 11224, checked in by Mathieu Morlighem, 13 years ago |
Some updates required to support matlab versions older than 7.6
|
File size:
1.3 KB
|
Rev | Line | |
---|
[465] | 1 | function marshall(md)
|
---|
[11217] | 2 | %MARSHALL - outputs a compatible binary file from @model md, for certain solution type.
|
---|
[1] | 3 | %
|
---|
[10969] | 4 | % The routine creates a compatible binary file from @model md
|
---|
[2547] | 5 | % This binary file will be used for parallel runs in JPL-package
|
---|
[1] | 6 | %
|
---|
| 7 | % Usage:
|
---|
[465] | 8 | % marshall(md)
|
---|
[1] | 9 |
|
---|
[9625] | 10 | disp(['marshalling file ' md.miscellaneous.name '.bin']);
|
---|
[1] | 11 |
|
---|
| 12 | %open file for binary writing
|
---|
[9625] | 13 | fid=fopen([ md.miscellaneous.name '.bin'],'wb');
|
---|
[1] | 14 | if fid==-1,
|
---|
[9625] | 15 | error(['marshall error message: could not open ' [md.miscellaneous.name '.bin'],' file for binary writing']);
|
---|
[1] | 16 | end
|
---|
| 17 |
|
---|
[11217] | 18 | %Go through all model fields: check that it is a class and call checkconsistency
|
---|
[11221] | 19 | fields=properties('model');
|
---|
[9597] | 20 | for i=1:length(fields),
|
---|
[10969] | 21 | field=fields{i};
|
---|
[9597] | 22 |
|
---|
[10969] | 23 | %Some properties do not need to be marshalled
|
---|
| 24 | if ismember(field,{'results' 'debug' 'radaroverlay' 'solver' 'cluster' 'flaim' 'private'}),
|
---|
| 25 | continue;
|
---|
[9597] | 26 | end
|
---|
[9373] | 27 |
|
---|
[10969] | 28 | %Check that current field is an object
|
---|
| 29 | if ~isobject(md.(field))
|
---|
| 30 | checkmessage(['field ''' char(field) ''' is not an object']);
|
---|
[9373] | 31 | end
|
---|
[9381] | 32 |
|
---|
[10969] | 33 | %Marshall current object
|
---|
| 34 | %disp(['marshalling ' field '...']);
|
---|
[11224] | 35 | if verLessThan('matlab', '7.6')
|
---|
| 36 | marshall(md.(field),fid);
|
---|
| 37 | else
|
---|
| 38 | md.(field).marshall(fid);
|
---|
| 39 | end
|
---|
[9373] | 40 | end
|
---|
[9385] | 41 |
|
---|
[10969] | 42 | %close file
|
---|
| 43 | st=fclose(fid);
|
---|
| 44 | if st==-1,
|
---|
| 45 | error(['marshall error message: could not close file ' [md.miscellaneous.name '.bin']]);
|
---|
[9385] | 46 | end
|
---|
Note:
See
TracBrowser
for help on using the repository browser.