How to save figures using mkdir if paths are variables?
Mostrar comentarios más antiguos
I am trying to save all of my figures into a directory that is generated using the date and time of running the code as the filename. The figures are being saved to a folder in a different directory. I would like to use mkdir to create the folders but I do not know how to get mkdir to read strings assinged to variables that contain the paths I want to save the figures to. My current directory is C:\Users\a\b\c\d\e\workspace but I want to save the figures to 'C:\Users\a\b\c\d\e\figures\dateTimeFolderName'. My final save folder structure should be 'C:Users\.....\figures\16-May-2022 13:41:03.617'. Is there a way to do this using mkdir?
savedir = 'C:\Users\a\b\c\d\e\figures\dateTimeFolderName'
startTime = 16-May-2022 13:41:03.617; % this is a date and time array that is produced when my code is run
if savefigs==1
mkdir savedir startTime
end
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre File Operations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!