I have a code that reads a bunch of .text files which are of the format "experiment_date_time" which is created by a measurement device. So a typical file name would look like
"Experiment_yyyymmdd_hhmmss.txt"
Sometimes due to an error in my device internal clock, the measurement are made at weird seconds and not 00 and this a problem when I try to load the files. My question is how do I rename a filename for just the last 2 characters? I tried this so far,
files=dir(''); for the file location %run each file through loop and rename
for i=1:length(files) [pathname,filename,extension] = fileparts(files(i).name); filename=filename(1:end-2)how do I append two zeros to the file name?Here I want to read the file name and replace the last two characters with zero. How do I do this?
Thanks, Ananth
Best Answer