Borrar filtros
Borrar filtros

save a matfile with date and time

39 visualizaciones (últimos 30 días)
Daniel Boateng
Daniel Boateng el 21 de Mzo. de 2019
Comentada: Daniel Boateng el 21 de Mzo. de 2019
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))

Respuesta aceptada

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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Workspace Variables and MAT-Files en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by