creating a new file

82 vues (au cours des 30 derniers jours)
Win Thomas Halim
Win Thomas Halim le 4 Mai 2011
Commenté : Walter Roberson le 16 Jan 2026 à 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 commentaires
Anjali
Anjali le 16 Jan 2026 à 9:15
how to create a new file in matlab
Walter Roberson
Walter Roberson le 16 Jan 2026 à 20:13
What do you want to have happen if there happens to be an existing file of the same name?

Connectez-vous pour commenter.

Réponse acceptée

Oleg Komarov
Oleg Komarov le 4 Mai 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 commentaires
Robert Cumming
Robert Cumming le 4 Mai 2011
Modifié(e) : Walter Roberson le 16 Jan 2026 à 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 le 30 Nov 2023
Right

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Programming Utilities dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by