save a matfile with date and time
32 次查看(过去 30 天)
显示 更早的评论
I want to save a matfile name optimization with the name Project and add time in addition to the name like Project_20/03/2019.mat. Please how do i do it. I tried this but it didnt work
time = datestr(now, 'yyyy_mm_dd');
filename = sprintf('Optimization_%s.mat',time)
save ('C:\dannyuser\Project',filename,datestr(now))
0 个评论
采纳的回答
Walter Roberson
2019-3-21
save( fullfile('C:\dannyuser\Project', filename) )
If you want the time to be put in as well as part of the file name, do so as part of that sprintf() you have.
3 个评论
Walter Roberson
2019-3-21
save( fullfile('C:\dannyuser\Project', filename), 'NameOfYourOptimizationVariable')
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Workspace Variables and MAT-Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!