Hi, I have collected acceleration data by a multi-channel data acquisition system. Each file (E1431A*.DAT) contains one column with real numbers. The contents of the i-th file should be stored in the i-th row of a data matrix A. How can I manage this task efficiently ? Are there suitable python modules for this purpose ? A small example would be appreciated. Nils
Nils Wagner wrote:
Each file (E1431A*.DAT) contains one column with real numbers. The contents of the i-th file should be stored in the i-th row of a data matrix A.
Are the files binary or ASCI ? if ASCI, look in Scipy, there are a couple of modules for this kind of thing, I doubt any of them are set up for multiple files, so you'll have to loop through the file list. If binary, you can do something like: while row < NumRows: file = open(filename,'rb') A[row,:] = fromstring(file.read(),Float) # make sure you get the typecode right! file.close() row += 1 WARNING: not the least bit tested. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker@noaa.gov
participants (2)
-
Chris Barker
-
Nils Wagner