[問題] 有關unformatted格式 輸出與讀取的問題

看板Fortran作者 (田裡的稻草人)時間16年前 (2009/01/22 10:51), 編輯推噓1(102)
留言3則, 1人參與, 最新討論串1/1
不好意思麻煩大家..因為實在不知道哪邊寫錯了 我在輸出和讀入資料的時候遇到一些問題 是不是在輸出的時候要先加上什麼東西呢?? 輸出------------------------------------------------------------------------ open(110,file='5MIN_AEVCI.dat',FORM='UNFORMATTED',status='unknown' &) do 11 KBIN=1,12 do 11 K=1,KMAX do 11 J=2,JMAX-1 MINAE(J,K,KBIN)=AE_VC(J,K,KBIN)*(ZF(J,K,islab)-Z(J,K,islab &))*2 write(110) MINAE(J,K,KBIN) 11 CONTINUE 讀取------------------------------------------------------------------------- open(INUNIT,File='5MIN_AEVCI.dat',FORM='UNFORMATTED',status='old') 第74行 READ(INUNIT)(((AE_VCI(J,K,L),J=2,JMAX-1),K=1,KMAX), & L=1, NAESPCOUT) 出現的錯誤------------------------------------------------------------------- PGFIO-F-219/unformatted read/unit=11/attempt to read/write past end of record. File name = 5MIN_AEVCI.dat unformatted, sequential access record = 1 In source file 5mintry.f, at line number 74 ---------------------------------------------------------------------------- 如果不用unformatted輸出的話.. 資料是像下面這樣 3.6449607681202432E-037 3.6493025809621877E-037 3.6357899655672954E-037 3.6318533166251616E-037 3.7365197930938510E-037 3.7316978668172212E-037 3.7294360396780513E-037 3.7398506412974553E-037 3.7566946674209580E-037 3.7323520205207537E-037 3.6834112490660513E-037 3.6589294844909537E-037 3.6579850385864172E-037 3.6698484744790423E-037 3.6417049057009496E-037 3.6704100834783961E-037 3.6585016593274613E-037 3.6385966176596996E-037 3.6369163417661547E-037 3.6356397283800290E-037 3.6327449143013615E-037 3.6355295349980112E-037 3.6783578307214091E-037 3.7180206963475433E-037 3.6809276362847143E-037 3.6569071042760060E-037 3.6774773084844217E-037 3.6458393898403516E-037 3.6409074418684861E-037 3.6374602109642140E-037 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 219.70.173.78

01/22 20:12, , 1F
這樣輸出有啥問題嬤 @_@?? 很正常呀..你的目的是????
01/22 20:12, 1F

01/22 20:13, , 2F
如果是unformated問題..那就別給unformated 嘍..預設就是unfo
01/22 20:13, 2F

01/22 20:13, , 3F
FORM 跟 status 都不是必要給的..這兩個都有預設值了y
01/22 20:13, 3F
文章代碼(AID): #19TzyfH7 (Fortran)
文章代碼(AID): #19TzyfH7 (Fortran)