3 |
% |
% |
4 |
%inputs: myFile is the file name (must finish with '.data') |
%inputs: myFile is the file name (must finish with '.data') |
5 |
% myDim is the size of a field (2D or 3D integer vector) |
% myDim is the size of a field (2D or 3D integer vector) |
6 |
%(optional) myPrec is the file myPrecision (32, by default, or 64) |
%(optional 1) myPrec is the file myPrecision (32, by default, or 64) |
7 |
|
%(optional 2) fldList is the list of field names (cell array) |
8 |
|
|
9 |
%precision: |
%precision: |
10 |
if nargin>2; myPrec=varargin{1}; else; myPrec=32; end; |
if nargin>2; myPrec=varargin{1}; else; myPrec=32; end; |
11 |
|
if nargin>3; fldList=varargin{2}; else; fldList=[]; end; |
12 |
%number of dimensions |
%number of dimensions |
13 |
nDim=length(myDim); |
nDim=length(myDim); |
14 |
%number of records: |
%number of records: |
34 |
fprintf(fid,' ];\n'); |
fprintf(fid,' ];\n'); |
35 |
fprintf(fid,' dataprec = [ ''float%2i'' ];\n',myPrec); |
fprintf(fid,' dataprec = [ ''float%2i'' ];\n',myPrec); |
36 |
fprintf(fid,' nrecords = [ %5i ];\n',nRec); |
fprintf(fid,' nrecords = [ %5i ];\n',nRec); |
37 |
|
if ~isempty(fldList); |
38 |
|
nFlds=length(fldList); |
39 |
|
fprintf(fid,' nFlds = [ %i ];\n',nFlds); |
40 |
|
fprintf(fid,' fldList = {\n'); |
41 |
|
txt=' '; for ii=1:length(fldList); txt=[txt '''' fldList{ii} '''' ' ']; end; |
42 |
|
fprintf(fid,[txt '\n']); |
43 |
|
fprintf(fid,' };\n'); |
44 |
|
end; |
45 |
%% |
%% |
46 |
fclose(fid); |
fclose(fid); |
47 |
|
|