Hello Aliaa,
It's good that your files are plain text, you can open them in MATLAB easily.
You need to write a program, consisted of a for loop which has the same number as the number of your files 365.
It's also good that you know all the headers are from line 1 to 21, as you can simply get rid of them.
Hopefully, your files have some sort of order in their names, like cnb1,cnb2,...,cnb365 or any other order.
lets say cnb1 is the first file we want to edit.
use fopen to open cnb1
use fopen to open another file in a different folder with the same name cnb1 (this is going to be the new file without the header)
use getl to read one line at a time
create a while loop to read and write line by line to the files, while should stop when the result of fgetl is empty
make a counter for lines in the while loop
make an if so when the number of counter is smaller than 21 it won't write to the new cnb1 file.
that's all!
finally outside the while loop close both files using fclose
see these in MATLAB documentation
doc fopen
doc fclose
doc fgetl
doc while
doc for
Oh! in the main for loop before you open cnb1 cnb2 and ... you need to create their names lets assume
for i = 1 :10
filename = ['C:\myFolder\cnb',num2str(i),'.txt'];
Although your files are not txt it's just an assumption.
Give it a try, and let us know if you have prob.
I'll attach a similar file where I edited a txt file, just to see how you can open files, read them and ...
Good Luck!
Best Answer