creating a new file

60 visualizaciones (últimos 30 días)
Win Thomas Halim
Win Thomas Halim el 4 de Mayo de 2011
Comentada: Walter Roberson el 16 de En. de 2026 a las 20:13
hi there, anyone know hot to save results to a file in matlab?(i.e. create new file) suppose i had this x,y,z data that i want to save it as "results.str" that is openable via notepad. i really need help here! anyone can help? thank you very much.
  2 comentarios
Anjali
Anjali el 16 de En. de 2026 a las 9:15
how to create a new file in matlab
Walter Roberson
Walter Roberson el 16 de En. de 2026 a las 20:13
What do you want to have happen if there happens to be an existing file of the same name?

Iniciar sesión para comentar.

Respuesta aceptada

Oleg Komarov
Oleg Komarov el 4 de Mayo de 2011
Create new file discarding content if already exists:
fid = fopen('results.str','w');
fprintf(fid,'%f,%f,%f\r\n',[1 2 3; 4 5 6].');
fid = fclose(fid);
  2 comentarios
Robert Cumming
Robert Cumming el 4 de Mayo de 2011
Editada: Walter Roberson el 16 de En. de 2026 a las 20:12
to add to Olegs answer you can add the following line to view the file in notepad:
system ( 'notepad results.str' )
Hamza
Hamza el 30 de Nov. de 2023
Right

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Programming Utilities 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!

Translated by