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
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.
Mahsa Keyvani
Mahsa Keyvani 2019년 1월 16일
Thank you so much for your help. I tried wordpad and notepad++, but they did not provide carriage return. I did it with microsoft word at the end.

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2019년 1월 16일

0 개 추천

S = fileread('testAppend_Jan16.txt');
NewS = regexprep('Event', '\r\nEvent');
fid = fopen('testAppend_Jan16_out.txt');
fwrite(fid, '%s', NewS);
fclose(fid)

댓글 수: 1

Mahsa Keyvani
Mahsa Keyvani 2019년 1월 17일
Thank you so much again for helping me. There is an error with fwrite; It says: Error using fwrite Invalid precision. Thanks.

댓글을 달려면 로그인하십시오.

카테고리

질문:

2019년 1월 16일

댓글:

2019년 1월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by