creating a new file

51 visualizzazioni (ultimi 30 giorni)
Win Thomas Halim
Win Thomas Halim il 4 Mag 2011
Commentato: Walter Roberson il 16 Gen 2026
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 Commenti
Anjali
Anjali il 16 Gen 2026
how to create a new file in matlab
Walter Roberson
Walter Roberson il 16 Gen 2026
What do you want to have happen if there happens to be an existing file of the same name?

Accedi per commentare.

Risposta accettata

Oleg Komarov
Oleg Komarov il 4 Mag 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 Commenti
Robert Cumming
Robert Cumming il 4 Mag 2011
Modificato: Walter Roberson il 16 Gen 2026
to add to Olegs answer you can add the following line to view the file in notepad:
system ( 'notepad results.str' )
Hamza
Hamza il 30 Nov 2023
Right

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Workspace Variables and MAT Files in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by