필터 지우기
필터 지우기

fortran error reading .txt file made in matlab

조회 수: 4 (최근 30일)
Adrianna
Adrianna 2011년 2월 15일
Hi,
I am trying to pass a double precision array from Matlab to Fortran. I save the array in a .txt file.
Using save('file.txt','data','-ascii', '-double'), works sometimes but not always.
I have tried: fid = open('file.txt','w'); fprint(fid,[repmat('%.16g', 1,size(data,2)),\n],data); fclose(fid); But this does not work either.
The error I get from Fortran is: An endfile record was detected in READ statement.
Also this is being implemented on a Windows machine, although I get a similar error on a linux machine. I believe the problem is with the formating of the file from Matlab.
Any help is much appreciated.

답변 (1개)

Andrew Newell
Andrew Newell 2011년 2월 15일
The answer to your problem may be in Handling End-of-File: the READ Statement Revisited.

카테고리

Help CenterFile Exchange에서 Fortran with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by