How to Read Fortran 90 Unformatted Binary Files into Matlab

1 回表示 (過去 30 日間)
Sunghan Kim
Sunghan Kim 2013 年 12 月 4 日
回答済み: James Tursa 2013 年 12 月 4 日
Is it even possible to read unformatted binary files created by fortran 90 (on Linux) into Matlab running on Windows? These binary files do not even have any extension.
Please, help me so that I can crack into the files.
-- SK
  1 件のコメント
dpb
dpb 2013 年 12 月 4 日
Possible, yes...but you'll have to know the record length and how the given compiler writes the internal structure to do so.
I would recommend rather than using 'UNFORMATTED' to create the files as stream files. Depending on the compiler and age thereof, the way to do this may be by using an extension ('BINARY' is one fairly common one) although it has now been standardized by later Standards and the commonly-available compilers all now support writing stream files in a Standard manner.
If you do this, fread will be all you'll need with the matching precision and endian-ness taken care of in fopen and the conversion specification.

サインインしてコメントする。

回答 (1 件)

James Tursa
James Tursa 2013 年 12 月 4 日
See this thread for an example of reading Fortran unformatted binary data into MATLAB:

カテゴリ

Help Center および File ExchangeFortran with MATLAB についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by