writetableにてファイルを連番出力したい
13 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
RYO ARATA
le 17 Oct 2022
Commenté : Hernia Baby
le 18 Oct 2022
以下のコードでtという変数をxlsxファイルにて保存しているのですが、ループ処理の中でこれを使いたいため、拡張子はそのままで名前をresult01,result02のように連番でつけて保存するためにはどうしたら良いでしょうか?
writetable(t,'result.xlsx');
0 commentaires
Réponse acceptée
Shunichi Kusano
le 17 Oct 2022
こんな感じです。フォルダ内で思ったように整列されるようゼロ埋めするところがポイントです。
for i = 1:10
filename = sprintf("result%02d.xlsx",i) % 0はゼロ埋め、2は二桁、dは整数の意味です。
end
1 commentaire
Hernia Baby
le 18 Oct 2022
N = 10;
filename = num2str([0:N].','result%02d.xlsx')
要素で取り出す場合は以下の通りです。
filename(1,:)
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!