How to save figures using mkdir if paths are variables?
Show older comments
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
Accepted Answer
More Answers (0)
Categories
Find more on File Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!