Create a blank m-file by command lines

Hi,
I am writing a GUI that needs to save strings of text into an m-file. Basically a GUi that creates scripts. How can I do that?
I found this in the help menu:
fid = fopen('exp.txt', 'w'); fprintf(fid, '%6.2f %12.8f\n', y); fclose(fid);
But that requires the text file to be created before using fopen. How do I create a new m-file that is blank?
Horace

 採用された回答

Iain
Iain 2013 年 6 月 24 日
編集済み: Adam Danz 2021 年 11 月 20 日

0 投票

fid = fopen('D:\myfileshere\newfile.m','w'); fclose(fid);
That will in fact create a new "m" file.

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeWorkspace Variables and MAT Files についてさらに検索

質問済み:

2013 年 6 月 24 日

編集済み:

2021 年 11 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by