I have time series data for a day, split into roughly 5 minute segments each of which is in a separate txt file, each with several rows of headers and information above the data.
Hence I want to merge all 198 txt files to one txt file with only the continuous timeseries data. How can I merge the files, removing the 30 rows of unnecessary information from the top of each.
I have had success merging them all together using the code below, but that is without removing the initial 30 rows from each .txt file
files=dir('*.txt');fileout='merged.txt';fout=fopen(fileout,'w');for cntfiles=1:length(files) fin=fopen(files(cntfiles).name); while ~feof(fin) fprintf(fout,'%s %d\n',fgetl(fin),cntfiles); end fclose(fin);endfclose(fout);
Best Answer