|
Last change
on this file since 6389 was 6389, checked in by Eric.Larour, 15 years ago |
|
Finished debugging io_gather mode for I/O file output. Works great on astrid.
|
|
File size:
873 bytes
|
| Line | |
|---|
| 1 | function results=parseresultsfromdisk(filename)
|
|---|
| 2 | %PARSERESULTSFROMDISK - ...
|
|---|
| 3 | %
|
|---|
| 4 | % Usage:
|
|---|
| 5 | % results=parseresultsfromdisk(filename)
|
|---|
| 6 |
|
|---|
| 7 | %Open file
|
|---|
| 8 | fid=fopen(filename,'rb');
|
|---|
| 9 | if(fid==-1),
|
|---|
| 10 | error(['loadresultsfromdisk error message: could not open ',filename,' for binary reading']);
|
|---|
| 11 | end
|
|---|
| 12 | results=struct();
|
|---|
| 13 |
|
|---|
| 14 | %Read fields until the end of the file.
|
|---|
| 15 | result=ReadData(fid);
|
|---|
| 16 | while ~isempty(result),
|
|---|
| 17 |
|
|---|
| 18 | %Get time and step
|
|---|
| 19 | results(result.step).step=result.step;
|
|---|
| 20 | results(result.step).time=result.time;
|
|---|
| 21 |
|
|---|
| 22 | %Add result
|
|---|
| 23 | if (length(results)>=result.step & isfield(results,result.fieldname)),
|
|---|
| 24 | results(result.step).(result.fieldname)=[ results(result.step).(result.fieldname); result.field];
|
|---|
| 25 | else
|
|---|
| 26 | results(result.step).(result.fieldname)=result.field;
|
|---|
| 27 | end
|
|---|
| 28 |
|
|---|
| 29 | %read next result
|
|---|
| 30 | result=ReadData(fid);
|
|---|
| 31 |
|
|---|
| 32 | end
|
|---|
| 33 |
|
|---|
| 34 | %process patch if necessary
|
|---|
| 35 | results=MatlabProcessPatch(results);
|
|---|
| 36 |
|
|---|
| 37 | fclose(fid);
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.