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

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

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


Revision 1.1 - (show annotations) (download)
Wed Dec 22 01:04:08 2010 UTC (14 years, 6 months ago) by gforget
Branch: MAIN
CVS Tags: checkpoint65r, checkpoint65p, checkpoint65q, checkpoint65t
- rdmds2workspace.m	load all fields from rdmds file, assuming
			that names are incldued in the meta file
- read2memory.m write2file.m	basic binary read/write shortcuts

1 function []=write2file(fileOut,fldIn,varargin);
2 %purpose: write array to binary file
3 %
4 %inputs: fileOut is the file name
5 % fldIn is the array to write to disk
6 %(optional) prec is the file precision (32, by default, or 64)
7
8 if nargin>2; prec=varargin{1}; else; prec=32; end;
9
10 if ~ischar(fldIn);
11 fid=fopen(fileOut,'w','b'); tmp1=fldIn; tmp1(isnan(tmp1))=0; fwrite(fid,tmp1,['float' num2str(prec)]); fclose(fid);
12 else;
13 fid=fopen(fileOut,'wt'); fwrite(fid,fldIn); fclose(fid);
14 end;
15
16
17

  ViewVC Help
Powered by ViewVC 1.1.22