- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
I have an input file thatshould be read20 times.
first timemy input file has one line.(my variableis locatedon first line and should be read )
second timemy input file hastwo lines.(my variable is located onsecond line and should be read )
thirdtime my input file has three lines.(my variable is located onthird line and should be read )
forthtime my input file hasfour lines.(my variable is located onforth line and should be read )
.
.
,
twentith time,my input file hastwenty lines.(my variable is located ontwentith lines and should be read )
for example:
* first time
Open(Unit=765,File='C:\\Temp\\disp3.dat'
* ,Action='read',Status='old',position='asis')
read(765,'(/1x,E12.5)')scx3
* second time ( next execution)
Open(Unit=765,File='C:\\Temp\\disp3.dat'
* ,Action='read',Status='old',position='asis')
read(765,'(/1x,E12.5)')scx3
.
,
,
but It didnt work. Please tell me how I solve my problem.
my input file after execution is sth like that each line should be read each time:
0.0000E+00
0.0000E+00
0.0000E+00
0.0000E+00
-4.1723E-07
3.5763E-07
4.1723E-07
1.5046E-01
2.7354E-01
1.2248E-01
1.5009E-01
1.5148E-01
1.3132E-01
1.2248E-01
1.5009E-01
1.5148E-01
1.3132E-01
4.1723E-07
1.5046E-01
2.7354E-01
1.2248E-01
Thanks in advance.
Regards,John
コピーされたリンク
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Why do your input formats have '/' in them? That will cause a line to be skipped.
Why does your input data span 21 lines?
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Dear mecej4
hi
As I said, my input file has 1 line in first time ( 1s), so I read first line.
second time ( 2s) my input file has2 lines, so I want to read justsecond line.
thirdtime ( 3s) my input file has3 lines, so I want to read justthird line.
.
.
.
so now tell me how I can read just one line of my file.
Thanks in advance.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
open (uu,file=<file_name>,form='formatted', &
access='direct',status='old',recl=11)
read (uu, fmt='(E10.4)', rec=n) x
will read the real number on line n into the variable x.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Is the same program writing to the file as is reading it, or is it being modified elsewhere?
If your 'read' program is also 'writing' the new record, then the file will be positioned after the latest write, so long as you do not CLOSE and reOPEN the file between your last read and the next write. Then, if you want to read the last record written, just use BACKSPACE on the unit to which the file is connected. However, if you close the file after reading, then reOPen it and then APPEND the next written record, the situation should be just the same and a BACKSPACE will position the file just before the last record appended, ready to read it.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
hi
Thanks for your reply.
My input is come from python, As I know python better than fortran.so,I change my input file and it has
one line each time. Now I have solved my problem.
Thanks for your support.
Regards,
John.
