function date_and_time=date_time_stamp %pretty self-explanatory c=clock; %correcting if month has only single digit if c(2)/10 < 1 month=cat(2,0,c(2)); else month=c(2); end %correcting if day has only single digit if c(3)/10 < 1 day=cat(2,0,c(3)); else day=c(3); end %correcting if hour has only single digit if c(4)/10 < 1 hour=cat(2,0,c(4)); else hour=c(4); end %correcting if minute has only single digit if c(5)/10 < 1 minute=cat(2,0,c(5)); else minute=c(5); end %correcting if second has only single digit if c(6)/10 < 1 second=cat(2,0,c(6)); else second=c(6); end %making the actual date and time string daate=int2str(cat(2,c(1),month,day)); tiime=int2str(cat(2,hour,minute,second)); daateandtiime=strcat(daate,'T',tiime); date_and_time=strrep(daateandtiime,' ','');