how to naming files sequently?

1 回表示 (過去 30 日間)
Lilya
Lilya 2017 年 8 月 18 日
コメント済み: Lilya 2017 年 8 月 19 日
Hi all,
could anyone help me with this file naming (control loop)
TOTL_REDC_2017_07_ 02_0500
the bold part is fixed in all files, while the remaining part is different
02 corresponding to number of days (02, 03, 04, ..., 29, 30, 31)
0500 corresponding to number of hours (0500, 0600, 0700, ..., 2200, 2300, 0000(second day)... etc))
thank you for your help.

採用された回答

Walter Roberson
Walter Roberson 2017 年 8 月 18 日
prefix = 'TOTL_REDC_2017_07';
ThisFileName = sprintf('%s_%02d_%04d', prefix, this_day_number, this_hour_number)
  1 件のコメント
Lilya
Lilya 2017 年 8 月 19 日
thank so much Mr. Walter.

サインインしてコメントする。

その他の回答 (1 件)

KL
KL 2017 年 8 月 18 日
編集済み: KL 2017 年 8 月 18 日
prefix = 'TOTL_REDC_2017_07_';
days = {'02_','03_'};
hours = {'0500','0600'};
fileNames = cellfun(@(d,h) [prefix d h], days, hours, 'UniformOutput',false);
  1 件のコメント
Lilya
Lilya 2017 年 8 月 19 日
thank you so much.

サインインしてコメントする。

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by