help automating 'read in process' and general automating help [message #62103] |
Fri, 22 August 2008 18:33 |
mbweller
Messages: 24 Registered: July 2008
|
Junior Member |
|
|
Hi all,
I need to read in anywhere from 200 to 36000 ascii files and convert
them into .sav files. I was looking for some help in running a script
to do this.
I've been using this method (below), but it is far too time consuming
with this many files.
------------------------------------------------------------ ------------------------------------------------------------ -------------------------------------------
IDL> table = read_ascii('g:\Mars_tectonics\10deg _analysis
\a6.txt',template=ascii_template('g:\Mars_tectonics\10deg _analysis
\a6.txt'))
IDL> help,table,/structure
** Structure <1229360>, 3 tags, length=300, data length=300, refs=1:
FIELD1 INT Array[30]
FIELD2 FLOAT Array[30]
FIELD3 FLOAT Array[30]
IDL> a6=fltarr(3,30)
IDL> a6[0,*]=table.field1
IDL> a6[1,*]=table.field2
IDL> a6[2,*]=table.field3
save,a6,filename='g:\mars_tectonics\10deg _analysis\a6.sav'
------------------------------------------------------------ ------------------------------------------------------------ ---------------------------------------------
They'll mostly be of this format and the naming convention is A-R and
1-16 (for this smaller iteration).
This is important: if no file is found, i need it to create an array
of 0's.
Eventually, perhaps the end of this week, I'll need to work this
reading method into my actual computational program, but that's a
little bit later.
As an aside, does anyone know of a way/program/code that'll automate
the conversion of dbase files to ASCII? I have a program now that does
it, but it only does one at a time and adds odd characters that I then
must go in to manually delete.... Time consuming...
Thanks,
~Matt
|
|
|