How to open new text file and how to write on the text file using matlab code?
48 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
peyush
el 25 de Jul. de 2015
Comentada: peyush
el 26 de Jul. de 2015
How to open new text file and how to write on the text file using matlab code?
PS: How to go to next line(like we use Enter to go to next line) on the text file using code....can anyone help
0 comentarios
Respuesta aceptada
Image Analyst
el 25 de Jul. de 2015
Try something like this
fid = fopen(filename, 'wt');
if fid ~= -1
fprintf('This is line 1. Backslash n makes a new line.\n');
fprintf('My result is %f\n, result);
fprintf('My string = %s\n', myString);
fclose(fid);
else
warningMessage = sprintf('Cannot open file %s', filename);
uiwait(warndlg(warningMessage));
end
7 comentarios
Image Analyst
el 26 de Jul. de 2015
But if you want extra safety and security of saving the old version in the recycle bin instead of blowing it away forever, do this:
recycle on;
delete(filename);
Más respuestas (0)
Ver también
Categorías
Más información sobre Low-Level File I/O en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!