24小时热门版块排行榜    

查看: 2833  |  回复: 0

3sGirl

新虫 (小有名气)

[求助] IDL中读*.prv文件出现的错误:READF: End of file encountered. Unit: 101,

各位大侠:
       您们好!

      用IDL读*.prv 文件,出现的错误:READF: End of file encountered. Unit: 101, File: G:“book.txt”  代码如下:if file_test(txtname)then begin;The FILE_TEST function checks files for existence and other attributes without having to first open the file/用来检查文件是否存在及在不打开文件的情况下检查其属性
  nLines=file_lines(txtname);file_lines()用于返回数据的行
  tmp=" ";定义一个字符串变量
   openr,lun,txtname,/get_lun   ;  打开文件
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  while(~EOF(lun))do begin;
    readf,lun,tmp;读取第一行
;         print,tmp
;         help,tmp
    Col=strsplit(tmp,/extract);拆分第一行获取列数
    ColNum=N_elements(Col)
  Arr_1=dblarr(ColNum,nLines-1);定义一个n列n-1行,元素为0的数组
   ;point_lun,lun,2
   
   readf,lun, Arr_1  ;READF requires a file unit to be explicitly specified---明确指定文件单元
   
     Arr_1=[[Col],[ Arr_1]];重新组合数组(n,n-1)+第一行=(n,n)
   
  endwhile
   print, Arr_1[*,1:*]
   
   free_lun,lun ;; Close the file and free the file unit

endif

继续您的指导,谢谢!
回复此楼

» 猜你喜欢

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 3sGirl 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[基金申请] 应该是93bebmhtak前后十一个字符比较关键 +16 Lanmanbaby 2026-08-09 25/1250 2026-08-11 15:51 by 医学老男孩
[基金申请] 小木虫上这么多卖论文的,真有人买论文么?感觉没必要啊 +7 Tide man 2026-08-10 8/400 2026-08-11 15:49 by 铁帽子农民
[基金申请] 为什么网上很多人说本周 12号出结果 +6 瞬息宇宙 2026-08-10 6/300 2026-08-11 13:19 by JACS/Angew
[基金申请] 听说今天filecode变了 +26 布布和一二 2026-08-06 49/2450 2026-08-11 13:18 by WH3796
[基金申请] FileCode能看出啥? +7 要乐观耀哥 2026-08-10 17/850 2026-08-11 10:50 by 要乐观耀哥
[基金申请] filecode +9 documentary 2026-08-10 9/450 2026-08-11 10:08 by wk7465
[基金申请] 基金中了 +15 laoda193707 2026-08-06 15/750 2026-08-11 00:11 by jiafei2190
[基金申请] 综述论文作为代表作会不会影响评审专家的印象分? +10 yufeiwaner 2026-08-09 11/550 2026-08-10 18:47 by yufeiwaner
[基金申请] 关于Filecode分析方法 +3 majunge000 2026-08-10 3/150 2026-08-10 15:46 by lch2012
[基金申请] 国自然结果 +4 Vierhys 2026-08-10 8/400 2026-08-10 15:06 by Vierhys
[基金申请] 好奇怪的filecode +4 布布和一二 2026-08-08 5/250 2026-08-10 14:20 by 冰心玉壶晴
[基金申请] 2026国自然放榜时间 +9 布布和一二 2026-08-08 9/450 2026-08-10 11:22 by xxxx2020
[基金申请] 这样的filecode谁见过 +11 布布和一二 2026-08-08 22/1100 2026-08-10 11:10 by wmfsnow
[基金申请] filecode与中标关系的预测 +5 布布和一二 2026-08-07 5/250 2026-08-09 16:15 by 袁向阳007
[基金申请] 国基金的申报应该改成非等额制,评价高的钱多评价低的钱少,但是增加资助率 +7 a089 2026-08-07 7/350 2026-08-08 18:05 by gltch
[基金申请] 化学口download_prp&fileCode的固定段好像这几天一直没变,有变的大神么? +3 Tide man 2026-08-07 4/200 2026-08-07 22:39 by Tide man
[基金申请] 固定端突然变了,今天 +6 archvillain 2026-08-06 10/500 2026-08-07 16:03 by 医学老男孩
[基金申请] filecode +8 布布和一二 2026-08-06 11/550 2026-08-06 20:41 by tangpu318
[基金申请] 求各位大神看下 100+6 hpkpkpkp 2026-08-05 33/1650 2026-08-06 14:49 by zhiyanjiang
[基金申请] 好消息?这个有何含义??? +8 Tide man 2026-08-05 10/500 2026-08-05 16:14 by xmuxiaoyu
信息提示
请填处理意见