changing fileextension of .in to .txt
9 views (last 30 days)
Show older comments
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
0 Comments
Answers (3)
Michael Haderlein
on 10 Jul 2014
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
Michael Haderlein
on 10 Jul 2014
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
0 Comments
See Also
Categories
Find more on Text Data Preparation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!