Please I want to know how to delete the first line of a file text with matlab ?

3 ビュー (過去 30 日間)
Imen Mani
Imen Mani 2016 年 5 月 12 日
コメント済み: ubaid haroon 2017 年 10 月 20 日
Please help me ! thank you

採用された回答

Walter Roberson
Walter Roberson 2016 年 5 月 12 日
One way is to fopen the file for reading, fopen a different file for writing, fgetl the first line of the input and throw it away. Now fread the rest of the input and fwrite to the output. fclose both. Rename the output file to the input name.
There are other ways, but there is no direct way to delete a line: they all come down to copying input to output leaving out the part you do not want.
  6 件のコメント
Walter Roberson
Walter Roberson 2016 年 5 月 12 日
movefile('NewFile.txt', 'ExistingFile.txt');
ubaid haroon
ubaid haroon 2017 年 10 月 20 日
Very neat. I was able to use this piece of code

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLow-Level File I/O についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by