save a matfile with date and time

16 ビュー (過去 30 日間)
Daniel Boateng
Daniel Boateng 2019 年 3 月 21 日
コメント済み: Daniel Boateng 2019 年 3 月 21 日
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))

採用された回答

Walter Roberson
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
Walter Roberson 2019 年 3 月 21 日
save( fullfile('C:\dannyuser\Project', filename), 'NameOfYourOptimizationVariable')
Daniel Boateng
Daniel Boateng 2019 年 3 月 21 日
it works. Thank you very much

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWorkspace Variables and MAT Files についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by