Function diary does not change line in the text file

3 visualizaciones (últimos 30 días)
Ryan
Ryan el 18 de Nov. de 2020
Comentada: Steven Lord el 18 de Nov. de 2020
I write the following code,
diary Log.txt
disp('Hello!');
disp('World!');
diary off
The command window displays as follows,
Hello!
World!
It is correct.
But when I open the text file Log.txt using Notepad, the saved history shows as follows,
Hello!World!
It is wrong! The saved history in the text file does not change lines as the command window does.
But when I open the text file Log.txt on another computer also using Notepad, the saved history shows as follows,
Hello!
World!
It is correct.
Could anyone tell me what the problem is?

Respuestas (1)

Walter Roberson
Walter Roberson el 18 de Nov. de 2020
I suspect that you are opening the file using Notepad, which does not know about Linefeed alone as a delimiter. You should use a more modern editor.
  3 comentarios
Rik
Rik el 18 de Nov. de 2020
You should probably consider the suggestion from Walter. I personally prefer Notepad++, as that has many features, while still being a fast basic file reader.
Steven Lord
Steven Lord el 18 de Nov. de 2020
Another option, since you're using MATLAB, is to open the text file in the MATLAB Editor.

Iniciar sesión para comentar.

Categorías

Más información sobre Workspace Variables and MAT-Files en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by