Back to home page

MITgcm

 
 

    


Warning, /verification/flt_example/input/convert_ini.m is written in an unsupported language. File is not indexed.

view on githubraw file Latest commit fe48425a on 2009-01-04 01:04:51 UTC
fe48425a0e Jean*0001 
                0002 %- convert binary input file from native ieee to (ieee) big-endian:
                0003 fName='float_pos.input';
                0004 
                0005 imax=9;
                0006 [fid,errMsg]=fopen(fName,'r','n');
                0007 if ~isempty(errMsg),
                0008  fprintf(['ERROR in "rdsqbin" : try to open file=',fnam,'\n']);
                0009  fprintf(['==> ',errMsg]); fprintf('\n\n');
                0010  return
                0011 end
                0012 
                0013 r1=fread(fid,imax,'real*8');
                0014 np=r1(1);
                0015 
                0016 fprintf('read %i reccords ...',np);
                0017 rA=fread(fid,imax*np,'real*8');
                0018 fprintf(' OK\n');
                0019 fclose(fid);
                0020 rA=reshape(rA,[imax np]);
                0021 
                0022 var=zeros(imax,np+1); 
                0023 var(:,1)=r1;
                0024 var(:,2:np+1)=rA;
                0025 
                0026 namfil='float_pos.inp_b';
                0027 fid=fopen(namfil,'w','b'); fwrite(fid,var,'real*8'); fclose(fid);
                0028 
                0029