Each time you run the program, a new.msh file is generated

1 回表示 (過去 30 日間)
Chenglin Li
Chenglin Li 2022 年 11 月 15 日
回答済み: Rik 2022 年 11 月 15 日
I can generate a.msh file format file through this code
filename=['lin','.msh'] ;
fid=fopen(filename,'w');
But every time I run it, I will overwrite the previous data. I want to generate a new.msh file in the same path every time I run it.The generated file name is not required. What should I do?

採用された回答

Rik
Rik 2022 年 11 月 15 日
You can use the tempname function to generate a random file name.
You can also use sprintf to compose a file name that includes the date and time.
Alternatively you can use a FEX submission by Stephen to number your files automatically. You can look it up yourself, but I will edit my answer in a bit.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWaveform Generation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by