Hi,
I have used Fortran 90 to generate a huge array of reals (the dimensions are 5001 by 2287), and I have written this array to an unformatted Fortran binary using Fortran commands like the following:
OPEN(UNIT=15, FILE="output.dat", STATUS="REPLACE", ACTION="WRITE", FORM="UNFORMATTED")WRITE(15) dataCLOSE(UNIT=15)
Do you have any experience in reading unformatted Fortran binary files into Matlab? When I search around for options, it seems that there are several. For example, it seems that some people recommend first dumping the binary to a hexadecimal file, and then read the hexadecimal file using a Matlab script. (Unfortunately, I do not immediately know how to dump a Fortran binary to hexadecimal since I am new to Fortran. I will have to figure this out first.) On the other hand, it seems that there is a (non-MathWorks produced, non-MathWorks supported?) matOpen/matPutVariable API. However, it seems that this is mainly for C/C++, and might require some work to communicate with Fortran.
Do you have any advice of which direction I should head? Or would it be better if I somehow converted the Fortran binary to an ASCII text file and then read that text file into Matlab using dlmread?
Thank you very much for your time.
Andrew DeYoung
Carnegie Mellon University
Best Answer