MATLAB: How to make filename that message + date&time using [imwrite function]. filenameimwrite filenameMATLAB The MATLAB code is {imwrite(red, datestr(now,'yyyy-mm-dd HH-MM-SS-FFF'),'png');} I want to make file name "test_yyyy-mm-dd HH-MM-SS-FFF".png Please, Let me know the method. Thanks. Best Answer filename = strcat(datestr(now,'yyyy-mm-dd HH-MM-SS-FFF'),'.png');imwrite(red, filename);Solved? Problem was with the syntax for imwrite :-)Edit 1:filename = strcat('Test_',datestr(now,'yyyy-mm-dd HH-MM-SS-FFF'),'.png');imwrite(red, filename);Now? Related SolutionsMATLAB: Datetime problem of converting string hh is uppercaseD=datetime('2019/09/05 19:02:11', 'InputFormat','yyyy/MM/dd HH:mm:ss') MATLAB: Matlab imported excel time format change Assuming the date and time is stored as char arrays in both columns:dt = datetime(strcat(column1, ' ', column2), ... 'InputFormat', 'dd/MM/yyyy hh:mm:ss.SSS', ... 'Format', 'yyyy-MM-dd hh:mm:ss.SSS')If you want it back as char arrays:char(dt) Related QuestionConvert date to datetimeDatestr not working properlyHow to include milliseconds when converting datestr to datetimeHow to convert the format of a dateFrustrating datetime and datestr
Best Answer