p*w 发帖数: 124 | 1 I have a file, the data is
8-may-12,12.00,16.00,15.00
9-may-12,13.00,15.00,17.00
10-may-12,................
11-may-12,................
the problem is the initial field is
a string with variant length,
how to specify it so I can use a sigle
read to read them in?
thanks. | t*n 发帖数: 14458 | 2 use format, like
read(*,100) x1,x2,x3,......
100 format(9X, F5.2,1X, F5.2, 1X, F5.2,.....)
【在 p*w 的大作中提到】 : I have a file, the data is : 8-may-12,12.00,16.00,15.00 : 9-may-12,13.00,15.00,17.00 : 10-may-12,................ : 11-may-12,................ : the problem is the initial field is : a string with variant length, : how to specify it so I can use a sigle : read to read them in? : thanks.
| p*w 发帖数: 124 | 3 not working, because the first field could be 9 or 10 character.
【在 t*n 的大作中提到】 : use format, like : read(*,100) x1,x2,x3,...... : 100 format(9X, F5.2,1X, F5.2, 1X, F5.2,.....)
| w*******g 发帖数: 99 | 4 I don't think you can do it with single format... Perhaps this will happen in
the future F2000 not in 77/90/95 as I know.
【在 p*w 的大作中提到】 : I have a file, the data is : 8-may-12,12.00,16.00,15.00 : 9-may-12,13.00,15.00,17.00 : 10-may-12,................ : 11-may-12,................ : the problem is the initial field is : a string with variant length, : how to specify it so I can use a sigle : read to read them in? : thanks.
| t*n 发帖数: 14458 | 5 you can try to use Ultraedit to add an additionala blank
hehehe
【在 p*w 的大作中提到】 : not working, because the first field could be 9 or 10 character.
| g****d 发帖数: 64 | 6 Try to read the first commer with charactor
variable or a spring variable. Then use 'if'
condition to judge the start of your data.
It should work. There are serveral ways to
achieve your purpose.
Even though Fortran is weak in this area, still
lots of stuff can be done.
【在 p*w 的大作中提到】 : I have a file, the data is : 8-may-12,12.00,16.00,15.00 : 9-may-12,13.00,15.00,17.00 : 10-may-12,................ : 11-may-12,................ : the problem is the initial field is : a string with variant length, : how to specify it so I can use a sigle : read to read them in? : thanks.
| t*n 发帖数: 14458 | 7 smart. ^o^
【在 g****d 的大作中提到】 : Try to read the first commer with charactor : variable or a spring variable. Then use 'if' : condition to judge the start of your data. : It should work. There are serveral ways to : achieve your purpose. : Even though Fortran is weak in this area, still : lots of stuff can be done.
| p*w 发帖数: 124 | 8 what is spring variable?
never heard of it
【在 g****d 的大作中提到】 : Try to read the first commer with charactor : variable or a spring variable. Then use 'if' : condition to judge the start of your data. : It should work. There are serveral ways to : achieve your purpose. : Even though Fortran is weak in this area, still : lots of stuff can be done.
| g****d 发帖数: 64 | 9 Sorry, it is string variable. Poor typing.
【在 p*w 的大作中提到】 : what is spring variable? : never heard of it
|
|