comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Read several files into one big data array?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Read several files into one big data array? [message #89507] Wed, 22 October 2014 13:57 Go to previous message
lucesmm is currently offline  lucesmm
Messages: 26
Registered: October 2014
Junior Member
I have tons of data files in the same folder. They are named correctly with the last 5 digits representing the order
Example
FILE_00001.dat
FILE_00002.dat
....
Within this files I have data formatted like this, The length of the data varies from file to file
_____________________________________
seconds Time data1 data2
189 00:03:09 111.20 770.62
3785 01:03:05 200.15 255.66
7345 02:02:25 198.83 779.16
10983 03:03:03 200.01 555.55

#Comments
#Comments
#Comments

____________________________________


I want to read all the files and storage the data in the following format
_________________________________________
data=[
00001 4189 00:03:09 111.20 770.62
00001 3785 01:03:05 200.15 255.66
00001 745 02:02:25 198.83 779.16
00001 10983 03:03:03 200.01 555.55
00002 532 02:56:00 888.01 998.20
00002 200 23:59:52 222.00 000.10
....]
_________________________________________
So this is what I have so far. But I am stock with getting the data from the title
PRO
files = file_search('\folder','*.dat', COUNT=nfiles)

for i=0, nfiles-1 do begin

nlines = FILE_LINES(files[i])
data = FLTARR(nlines)
OPENR, lunit, files[i], /get_lun
READF, lunit, data, FORMAT='(6(I, C(CHI.2, ':', CMI.2, ':', CSI.2),2F))'
CLOSE, lunit
FREE_LUN, lunit
endfor
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: bug in cgHasImageMagic
Next Topic: Fleurdelas - Carbomap's Open Source LiDAR file manipulator - now fully support LAS 1.4 and the Extra Bytes VLR

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:32:05 PDT 2025

Total time taken to generate the page: 0.00439 seconds