I am trying to read in a file with thousands of lines in the format:
AAAAAAAA 2013.99.2314.029 0 OFF N
This is a tab delimited file. The last column does not bother. The two columns before this are variables, so I read them as rows. My main problem is the second column. This is a number that is divided into several parts.
2013.99.2314.029
- year 2013, day 99, second 2314.029.
I want to use textscan to read the entire file at once, but somehow separate this complex date string when I read it.
I currently have a scan line:
SCAN_STR = '%s\t%f.%f\t%s\t%s\t%*s'
Which reads the date string in two floats. I would really like to read it in two ints and float. But using
SCAN_STR = '%s\t%d.%d.%f\t%s\t%s\t%*s'
Truncates it to 2013 and 2314 and ruins the rest of the line. I tried to run away. from '.' but it causes an error.
Any suggestions? I would like to do this because it is being scanned due to the large file size. When you try to change the types of large data sets, memory does not work.
EDIT:
Indeed, I need a scan string for 2013.99.2314.029 to return two integers and a float.
'%d.%d.%f'
Does not work. Also, no delimiter is used as ".". I also tried% u. He rounds the decimal when he reads them.
Le sigh.
source share