Re: help automating 'read in process' and general automating help [message #62088] |
Mon, 25 August 2008 04:03 |
Spon
Messages: 178 Registered: September 2007
|
Senior Member |
|
|
On Aug 25, 11:40 am, Spon <christoph.b...@gmail.com> wrote:
> On Aug 25, 4:46 am, mbwel...@gmail.com wrote:
>
>
>
>
>
>> Thanks for the response, I have another question though.
>
>> For the
>
>> IDL> help,table,/structure
>> ** Structure <1229360>, 3 tags, length=300, data length=300, refs=1:
>> FIELD1 INT Array[*]
>> FIELD2 FLOAT Array[*]
>> FIELD3 FLOAT Array[*]
>> IDL> a6=fltarr(3,*)
>
>> How might I set it up so that the * in the array automaticaly becomes
>> placed in the fltarr? i.e. if: array[30] then automatically place 30
>> into fltarr such that fltarr(3,30).
>> The table structure is throwing me off.
>
>> Thanks,
>> Matt
>
> a6 = Transpose( [ [Table.Field1], [Table.Field2], [Table.Field3] ] )
>
> Search for the array concatenation tutorial onhttp://www.dfanning.com
>
> Regards,
> Chris- Hide quoted text -
>
> - Show quoted text -
I guess the actual answer to your question is that you should be able
to get array sizes out of the structure like this:
NCols = N_Elements(Table.Field1)
My solution just skips that bit and joins up the structure fields into
one array, automatically converting the int column to floats in the
process.
|
|
|
Re: help automating 'read in process' and general automating help [message #62089 is a reply to message #62088] |
Mon, 25 August 2008 03:40  |
Spon
Messages: 178 Registered: September 2007
|
Senior Member |
|
|
On Aug 25, 4:46 am, mbwel...@gmail.com wrote:
> Thanks for the response, I have another question though.
>
> For the
>
> IDL> help,table,/structure
> ** Structure <1229360>, 3 tags, length=300, data length=300, refs=1:
> FIELD1 INT Array[*]
> FIELD2 FLOAT Array[*]
> FIELD3 FLOAT Array[*]
> IDL> a6=fltarr(3,*)
>
> How might I set it up so that the * in the array automaticaly becomes
> placed in the fltarr? i.e. if: array[30] then automatically place 30
> into fltarr such that fltarr(3,30).
> The table structure is throwing me off.
>
> Thanks,
> Matt
a6 = Transpose( [ [Table.Field1], [Table.Field2], [Table.Field3] ] )
Search for the array concatenation tutorial on
http://www.dfanning.com
Regards,
Chris
|
|
|
Re: help automating 'read in process' and general automating help [message #62092 is a reply to message #62089] |
Sun, 24 August 2008 20:46  |
mbweller
Messages: 24 Registered: July 2008
|
Junior Member |
|
|
Thanks for the response, I have another question though.
For the
IDL> help,table,/structure
** Structure <1229360>, 3 tags, length=300, data length=300, refs=1:
FIELD1 INT Array[*]
FIELD2 FLOAT Array[*]
FIELD3 FLOAT Array[*]
IDL> a6=fltarr(3,*)
How might I set it up so that the * in the array automaticaly becomes
placed in the fltarr? i.e. if: array[30] then automatically place 30
into fltarr such that fltarr(3,30).
The table structure is throwing me off.
Thanks,
Matt
|
|
|
Re: help automating 'read in process' and general automating help [message #62101 is a reply to message #62092] |
Fri, 22 August 2008 20:37  |
Jeremy Bailin
Messages: 618 Registered: April 2008
|
Senior Member |
|
|
On Aug 22, 9:33 pm, mbwel...@gmail.com wrote:
> 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
READCOL in the IDL Astronomy User's library might be useful for
reading them in. And FILE_SEARCH would also be useful for figuring out
if a given file exists or not.
-Jeremy.
|
|
|