- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I need to read big data file (20MB and greater) like
1 1.0 2334.444e3
100 -1.2356e8 3.13232346
...
On each line is one integer and two reals, but they can be formatted in different way (length). This file is not generated by me and each user uses different style of file.
I am using
read(10,'(A)') line
read(line,*) i
if (i<=0) then
cycle
endif
read(line,*) i,a,b
First I read file line to variable line to check if the first integer is >0, if not I discard this line
My problem is with last read statement, which is very slow, is there any possibility to set format specification but without length of numbers specified?
Jakub Zlamal
1 1.0 2334.444e3
100 -1.2356e8 3.13232346
...
On each line is one integer and two reals, but they can be formatted in different way (length). This file is not generated by me and each user uses different style of file.
I am using
read(10,'(A)') line
read(line,*) i
if (i<=0) then
cycle
endif
read(line,*) i,a,b
First I read file line to variable line to check if the first integer is >0, if not I discard this line
My problem is with last read statement, which is very slow, is there any possibility to set format specification but without length of numbers specified?
Jakub Zlamal
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No - the way you're doing it now is really the best approach. What you're asking for is effectively what list-directed is doing for you now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Steve Lionel (Intel)
No - the way you're doing it now is really the best approach. What you're asking for is effectively what list-directed is doing for you now.
You could try using a 'binary' file to speed up the process. Obviously this depands upon whether you are able to create the file as unformatted yourself.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page