/[MITgcm]/MITgcm_contrib/gael/matlab_class/gcmfaces_IO/write2file.m
ViewVC logotype

Diff of /MITgcm_contrib/gael/matlab_class/gcmfaces_IO/write2file.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1 by gforget, Wed Dec 22 01:04:08 2010 UTC revision 1.2 by gforget, Wed Mar 16 15:02:19 2016 UTC
# Line 6  function []=write2file(fileOut,fldIn,var Line 6  function []=write2file(fileOut,fldIn,var
6  %(optional)     prec is the file precision (32, by default, or 64)  %(optional)     prec is the file precision (32, by default, or 64)
7    
8  if nargin>2; prec=varargin{1}; else; prec=32; end;  if nargin>2; prec=varargin{1}; else; prec=32; end;
9    if nargin>3; omitNaNs=varargin{2}; else; omitNaNs=1; end;
10            
11  if ~ischar(fldIn);  if ~ischar(fldIn);
12      fid=fopen(fileOut,'w','b'); tmp1=fldIn; tmp1(isnan(tmp1))=0; fwrite(fid,tmp1,['float' num2str(prec)]); fclose(fid);      fid=fopen(fileOut,'w','b'); tmp1=fldIn;
13        if omitNaNs; tmp1(isnan(tmp1))=0; end;
14        fwrite(fid,tmp1,['float' num2str(prec)]);
15        fclose(fid);
16  else;  else;
17      fid=fopen(fileOut,'wt'); fwrite(fid,fldIn); fclose(fid);      fid=fopen(fileOut,'wt'); fwrite(fid,fldIn); fclose(fid);
18  end;  end;

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.22