[MITgcm-support] FORTRAN binary read help.

Jody Klymak jklymak at uvic.ca
Sun Nov 15 16:08:48 EST 2009


Hi All,

My I/O skills in FORTRAN are non-existent, and anything I could find  
online seemed very confusing,  so was hoping for a pointer here...

I want to read a vector of binary data written in Matlab in an array  
into the model.

x=cos(1:100);
ieee='l'
prec='real*8'

fid = fopen('../HorStruct.bin','w',ieee);
fwrite(fid,x,prec);
fclose(fid)

"prec" and "ieee" are what I use for the mdsio files, which work fine.



I *thought* the following worked, but it does not.

       _RL horStructWest(Nr)

       OPEN(111,FILE='HorStruc.bin')
       READ(111,*), horStructWst
       CLOSE(111)

Any pointers for how to do this?  If it matters, I'm on OS X,  
gfortran...

Thanks,  Jody


--
Jody Klymak
http://web.uvic.ca/~jklymak/







More information about the MITgcm-support mailing list