Back to home page

MITgcm

 
 

    


Warning, /verification/natl_box/matlab/writebin.m is written in an unsupported language. File is not indexed.

view on githubraw file Latest commit cdf4d124 on 2000-11-13 16:02:33 UTC
cdf4d1244c Patr*0001 function writebin(fnam,fld,typ,prec)
                0002 
                0003 % Function writebin(fnam,fld,typ,prec)
                0004 % write N-D binary field
                0005 %
                0006 % INPUTS
                0007 % fnam  input path and file name
                0008 % fld   input array
                0009 % typ   0: sequential FORTRAN (default);  1: plain binary
                0010 % prec  numeric precision (default 'real*4')
                0011 %
                0012 % SEE ALSO
                0013 % readbin
                0014 
                0015 if nargin < 4, prec='real*4'; end
                0016 if nargin < 3, typ=0; end
                0017 if nargin < 2, error('please specify array and output file name'); end
                0018 
                0019 fid=fopen(fnam,'w','ieee-be');
                0020 switch typ
                0021   case 0
                0022     write_record(fid,fld,prec);
                0023   case 1
                0024     fwrite(fid,fld,prec);
                0025 end
                0026 fid=fclose(fid);