avatar
help fortran read format# Computation - 科学计算
p*w
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.
avatar
t*n
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.

avatar
p*w
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,.....)

avatar
w*g
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.

avatar
t*n
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.
avatar
g*d
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.

avatar
t*n
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.

avatar
p*w
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.

avatar
g*d
9
Sorry, it is string variable. Poor typing.

【在 p*w 的大作中提到】
: what is spring variable?
: never heard of it

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。