fileread函数:IDL中将文本文件读入一个字符串数组中,每一行作为一个元素

FUNCTION  fileread,file
  ;file = DIALOG_PICKFILE(FILTER='*.*');也可以省略
  ;2010-08-28
  ;[email protected]
  LineCount = FILE_LINES(file);
  if (LineCount gt 0) then begin
    StringArray = strarr(LineCount);
    OPENR, unit, file, /GET_LUN
    READF, unit, StringArray
    FREE_LUN, unit
    FileString=StringArray
  endif  else begin
    FileString=''
    LineCount=0
  endelse
  RETURN,FileString
END
;===========================================


 

你可能感兴趣的:(function,File,filter,dialog,2010)