creating a new file

60 次查看(过去 30 天)
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 个评论
Anjali
Anjali 2026-1-16
how to create a new file in matlab
Walter Roberson
Walter Roberson 2026-1-16
What do you want to have happen if there happens to be an existing file of the same name?

请先登录,再进行评论。

采纳的回答

Oleg Komarov
Oleg Komarov 2011-5-4
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 个评论
Robert Cumming
Robert Cumming 2011-5-4
编辑:Walter Roberson 2026-1-16
to add to Olegs answer you can add the following line to view the file in notepad:
system ( 'notepad results.str' )

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Workspace Variables and MAT Files 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by