Generating a new line
1 回表示 (過去 30 日間)
古いコメントを表示
I have a dat file. It has data of time, temperature, currents, etc in a continuous manner and I can not open it in excel. I attached my file here.
I want to generate a new line before the word "Event" in the file. Basically, I want to start each line by the word "event". Could anyone please help me? Thank you.
2 件のコメント
Walter Roberson
2019 年 1 月 16 日
Try opening the file in NotePad++ or WordPad . It looks plausible to me that it might have newlines without carriage return, but the old NotePad does not recognize plain newlines as a line delimiter.
回答 (1 件)
Walter Roberson
2019 年 1 月 16 日
S = fileread('testAppend_Jan16.txt');
NewS = regexprep('Event', '\r\nEvent');
fid = fopen('testAppend_Jan16_out.txt');
fwrite(fid, '%s', NewS);
fclose(fid)
参考
カテゴリ
Help Center および File Exchange で Spreadsheets についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!