Reading data, without column header [message #79950] |
Tue, 10 April 2012 22:33 |
shambhu
Messages: 41 Registered: December 2011
|
Member |
|
|
Hi
I have a .dat file, which contains 5 columns. I want to read data of
the file in to other file for manipulation. I want to read it from
second row. Please tell me how to do.
I am using following code, but when i run first time it shows error
coz of type mis-match. When i continue with execution it works. Please
help mr to avoid his error.
data = fltarr(5)
filename = '/scratch/shambhu/cdays.dat'
openr,lun,filename,/get_lun
rows=file_lines(file)
for j=0, rows-1 do begin
readf, lun, data
t = data(0)
q = data(1)
Md = data(2)
h = data(3)
hplus = data(4)
endfor
free_lun, lun
Output:
IDL> readf, lun, data
% READF: Input conversion error. Unit: 100
File: /scratch/shambhu/cdays.dat
% Execution halted at: $MAIN$
IDL> readf, lun, data
IDL> print,data[0]
289.021
|
|
|