Hi all,
I'm having some trouble extracting data from a textfile. The files I'm working with have 100 lines of header information, which I have successfully extracted. After the header, there is a date (format 'yyyymmdd.HHMMss'), followed by two lines (describing the factor to multiply data by) and then 31 rows of numbers. Factor lines and 31 rows of numbers are repeated 5 times (1 per location), and then the next time step begins with the new date, the factor lines, and 31 rows of numbers repeated 5 times. I.e., For each time step, there are 5 blocks of numerical data (one per location) and associated factor lines.
The goal: search the file for the generic date format, extract the two lines below it (one is 'FACTOR', the next is a number %f), and then extract the subsequent 31 lines containing numbers into a cell. I then wish to skip the 4 remaining blocks of text and head to the next date, extract the first block into next cell element, etc, in that I only want data from one location. This process must be repeated until the end of the file.
The blocks of numbers are 31 rows x 48 columns.
Please let me know if more information would be helpful in solving this. I am not a beginner to Matlab, however I am a beginner in processing .txt files, so any guidance is greatly appreciated!
Best Answer