I have a problem reading a txt file that contains 10 columns and 2 header lines, but the problem is that in the middle of the file the same header appears several times and textread()
does not work. An example of my file:
file.txt
headerline1 aaaa headerline2 111 123 20/12/2000 name1 name2 name3... name8 0 21/12/2000 name1 name2 name3... name8 0 22/12/2000 name1 name2 name3... name8 0 headerline1 aaaa headerline2 111 123 25/12/2000 name1 name2 name3... name8 0 27/12/2000 name1 name2 name3... name8 0 ...
and this is my code i tried:
[date, name1, name2, name3, name4, name5, name6, name7, name8, status] = ... textread('file.txt', '%s %s %s %s %s %s %s %s %s %d', 'headerlines',2);
It gives an error exactly on the line with the re-header. Do you have any idea how I can avoid these headers and read the full file? The problem is that I have hundreds of these types of files, so I can’t delete it manually each time.
Thanks for the help.
source share