Read data from text file write into another file

14 ビュー (過去 30 日間)
srinu siliveru
srinu siliveru 2019 年 12 月 25 日
回答済み: Kojiro Saito 2019 年 12 月 25 日
Hi
How to read the following text
'*$rinu*'
from myfile.txt
and Write the same into myfile1.txt.
Thanks in Advance

回答 (1 件)

Kojiro Saito
Kojiro Saito 2019 年 12 月 25 日
I think low level file I/O is enough for this case.
fid = fopen('myfile.txt');
data = fscanf(fid, '%s');
fclose(fid);
fidw = fopen('myfile1.txt', 'w');
fprintf(fidw, '%s', data);
fclose(fidw);

カテゴリ

Help Center および File ExchangeText Files についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by