How to change mat files in each iteration?
4 次查看(过去 30 天)
显示 更早的评论
Hi. I am writing code which save output in mat file. I wanna it saves mat file that name changes to specific name with date and time of writing.tnx for e.g.:
...
Save doc3.mat matrix Convert to
Save doc3040620211407.mat matrix Which says this file has been creatwd in date 04/06/2021 in time of 14:07. Tnx
1 个评论
采纳的回答
Voss
2021-12-14
You can try this:
file_name = 'doc3.mat';
file_name = [file_name(1:end-4) datestr(now(),'mmddyyyyhhMM') file_name(end-3:end)];
% then save mat file with name file_name
It wasn't clear from your example whether 04/06 means April 6 or 4 June, this command assumes the month is first. To do day first, swap the 'mm' and 'dd'.
7 个评论
Image Analyst
2021-12-14
Posters with little activity so far, like you, can (I believe) post up to 10 questions per day.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!