HOW CAN A .DAT FILE BE EDITED
古いコメントを表示
Hi; I trying to change a certain number in a DAT file, the file consists of numbers and text as shown

The problem is every time I edit the file using commands like fprintf to overwrite the file, the external programme that supposes the read and executes the file gives me an error because it is not able to read the file anymore. please, is there a way to edit and save the file while it is still readable? Thanks
12 件のコメント
Stephen23
2017 年 6 月 8 日
"is there a way to edit and save the file while it is still readable"
Of course this is possible. However you did not give us any details of the file specifications, or what you tried so far, so how do you expect us to help you?
Ahmed Abed
2017 年 6 月 8 日
編集済み: dpb
2017 年 6 月 8 日
dpb
2017 年 6 月 8 日
You can try
fileID = fopen('strain determination 01.DAT','wt');
if it has to do with what the external program expects for EOL marks.
What we really need is to see a copy of the actual text file itself that is successfully read, NOT how it's displayed.
Ahmed Abed
2017 年 6 月 8 日
Stephen23
2017 年 6 月 9 日
@Ahmed Abed: please edit your question and upload a copy of the file by clicking the paperclip button.
Ahmed Abed
2017 年 6 月 9 日
Ahmed Abed
2017 年 6 月 9 日
Stephen23
2017 年 6 月 9 日
Both zip and txt files are supported by this forum, so if you change the extension to .txt it should be able to be uploaded. What size is the file? Do you get an error or warning? What browser are you using?
Ahmed Abed
2017 年 6 月 9 日
As we see in this screenshot, you try to attach a .rar file. The error message tells clearly, that this is not supported, but a .zip file would work and .txt files also.
Nevertheless, your problem is solved and attaching the file is not needed anymore.
Instead of using 'wt' in fopen, you can replace the line breaks also by '\r\n'. Beside the Editor shipped with Windows, your application seems to require the DOS linebreaks. What a pitty.
Ahmed Abed
2017 年 6 月 9 日
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Data Import and Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
