フィルターのクリア

Is there a way to rename a file to one that contains certain strings?

32 ビュー (過去 30 日間)
TW
TW 2024 年 7 月 1 日 15:56
編集済み: TW 2024 年 7 月 2 日 9:55
For example, we have the following variables stored:
Altitude = 2000
Mach=0.7
And suppose the script created an output file called output.txt.
Is there a way to, at the end of the run, rename the output.txt file to be called Output2000ft0.7m.txt so that it doesn't get overwritten on the next run?

採用された回答

Voss
Voss 2024 年 7 月 1 日 16:06
Altitude = 2000;
Mach = 0.7;
old_file_name = 'output.txt';
new_file_name = sprintf('Output%gft%gm.txt',Altitude,Mach);
movefile(old_file_name,new_file_name)

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by