| 7 | 1/1 | 返回列表 |
| 查看: 700 | 回復(fù): 6 | ||
[求助]
建立序列文件
|
|
如題 我想建立100個文件怎么弄? do 1=1,100 open(………………) write(……………………) end do 我想以這樣的方式創(chuàng)建100個文件,然后分別寫入數(shù)據(jù),應(yīng)該怎么用? 就比如一般的open這么用,這里 open(111,file='cif',status='old') file這一項怎么寫呢? |

至尊木蟲 (職業(yè)作家)

|
2樓: Originally posted by snoopyzhao at 2011-09-10 21:25:17: 看看這個: character(len=6) :: filename do i=1,100 write(filename,'(a,i0,a)') '(cif', i, ')' open(111, file = filename, status = 'old') write(111, *).... end do character(len=6) :: filename do i=1,100 write(filename,'(a,i0,a)') '(cif', i, ')' !!對變量filename 賦值為(cifi) open(111, file = filename, status = 'old') 。。!然后file的filename變量,創(chuàng)立文件是吧? write(111, *).... end do 可不可以這樣: do i=1,100 open(111, file = i, status = 'new') write(111, *).... end do |


至尊木蟲 (職業(yè)作家)
|
write(filename,'(a,i0,a)') '(cif', i, ')' 這句話的主要目的是生成 file 所對應(yīng)的文件名,其中的 '(a,i0,a)' 表示的是這個 filename 的格式是由一個字符串 (a)、一個長度不定的整數(shù) (i) 和 一個字符串 (a) 組成,比如 cif99 這樣的,但在這里需要前后加上括號,所以對應(yīng)的 filename 其實(shí)是 (cif99)... 具體詳情,請查閱 fortran 標(biāo)準(zhǔn)中有關(guān)內(nèi)部文件的說明…… |
至尊木蟲 (職業(yè)作家)
|
4樓: Originally posted by 賀儀 at 2011-09-10 23:03:59: character(len=6) :: filename do i=1,100 write(filename,'(a,i0,a)') '(cif', i, ')' 。!對變量filename 賦值為(cifi) open(111, file = filename, status = 'old') 。。!然后file的file ... open 中的 file 要求后面的值是一個字符串,所以你不能直接把 i 賦給 file,呵呵…… |
| 7 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 網(wǎng)絡(luò)空間安全0839招調(diào)劑 +3 | w320357296 2026-03-25 | 4/200 |
|
|---|---|---|---|---|
|
[考研] 347求調(diào)劑 +4 | L when 2026-03-25 | 4/200 |
|
|
[考研] 總分293求調(diào)劑 +4 | 加一一九 2026-03-25 | 4/200 |
|
|
[考研] 0854電子信息求調(diào)劑 324 +4 | Promise-jyl 2026-03-23 | 4/200 |
|
|
[考研] 0703化學(xué)調(diào)劑,求導(dǎo)師收 +7 | 天天好運(yùn)來上岸?/a> 2026-03-24 | 7/350 |
|
|
[考研] 【考研調(diào)劑】化學(xué)專業(yè) 281分,一志愿四川大學(xué),誠心求調(diào)劑 +15 | 吃吃吃才有意義 2026-03-19 | 16/800 |
|
|
[考研] 材料專碩找調(diào)劑 +5 | 哈哈哈吼吼吼哈 2026-03-23 | 5/250 |
|
|
[考研] 299求調(diào)劑 +7 | 某某某某位 2026-03-21 | 7/350 |
|
|
[考研] 335分 | 材料與化工專碩 | GPA 4.07 | 有科研經(jīng)歷 +4 | cccchenso 2026-03-23 | 4/200 |
|
|
[考研] 284求調(diào)劑 +3 | yanzhixue111 2026-03-23 | 6/300 |
|
|
[考研] 361求調(diào)劑 +3 | Glack 2026-03-22 | 3/150 |
|
|
[考研]
求調(diào)劑材料學(xué)碩080500,總分289分
5+3
|
@taotao 2026-03-19 | 21/1050 |
|
|
[考研]
|
2117205181 2026-03-21 | 8/400 |
|
|
[考研] 317求調(diào)劑 +12 | 申子申申 2026-03-19 | 18/900 |
|
|
[考研] 石河子大學(xué)(211、雙一流)碩博研究生長期招生公告 +3 | 李子目 2026-03-22 | 3/150 |
|
|
[考研] 298求調(diào)劑一志愿211 +3 | 上岸6666@ 2026-03-20 | 3/150 |
|
|
[考研] 求調(diào)劑院校信息 +6 | CX 330 2026-03-21 | 6/300 |
|
|
[考研] 311求調(diào)劑 +3 | 26研0 2026-03-20 | 3/150 |
|
|
[考研] 332求調(diào)劑 +3 | 鳳凰院丁真 2026-03-20 | 3/150 |
|
|
[考研] 材料學(xué)碩297已過四六級求調(diào)劑推薦 +11 | adaie 2026-03-19 | 11/550 |
|