changing fileextension of .in to .txt

hello people,
i need to edit a text file (example.in) with I/O functions but matlab doesn't support .in files so i need to change the extension to .txt and afterwards back to .in. how is that possible?
thanks a lot Cyros

답변 (3개)

Michael Haderlein
Michael Haderlein 2014년 7월 10일

0 개 추천

Dear Cyros,
what do you mean "matlab doesn't support"? You can open a file with random extension by fopen('filename.extension') and then use all I/O functions with the fid provided by fopen.
Best regards,
Michael

댓글 수: 1

Cyros
Cyros 2014년 7월 10일
편집: Cyros 2014년 7월 10일
Dear Michael, the file im using is example.in (input file). using fopen for that file returns -1, so i need to change the extension. i cant even attach this file here, "File format is unsupported".

댓글을 달려면 로그인하십시오.

Cyros
Cyros 2014년 7월 10일

0 개 추천

! ren example.in example.txt works
Michael Haderlein
Michael Haderlein 2014년 7월 10일

0 개 추천

I don't know what your code is, but when I save a textfile "example.in" containing just the line "1" and then open the file, I get exactly the answer "1":
fid=fopen('example.in');fgetl(fid), fclose(fid);
ans =
1
fid=-1 usually means that the file is not found. Maybe you didn't give the correct path to the file or have a typo in the filename.
Best regards,
Michael

카테고리

도움말 센터File Exchange에서 Text Data Preparation에 대해 자세히 알아보기

질문:

2014년 7월 10일

답변:

2014년 7월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by