Re: Forcing READ_ASCII output to be a set of strings... [message #43002] |
Mon, 14 March 2005 10:42  |
Jonathan Greenberg
Messages: 91 Registered: November 2002
|
Member |
|
|
I kinda answered my own question -- I took the read_ascii.pro that IDL
distributes and simply changed the default behavior on this line:
fieldTypesUse = REPLICATE(4L, fieldCountUse)
To
fieldTypesUse = REPLICATE(7L, fieldCountUse)
This appears to work fine... I'm kicking IDL a request to modify this so
it'll default to a user-defined format...
--j
On 3/14/05 9:56 AM, in article BE5B1035.416B%usenet@estarcion.net, "Jonathan
Greenberg" <usenet@estarcion.net> wrote:
> I'm trying to use READ_ASCII to read in a text file which contains
> parameters for the algorithm I'm developing (so the user just modifies the
> .csv file instead of having to type all the parameters into the idl command
>
> line). It appears to be defaulting to an array of floating points in the
> structure, but I want the values to be read in as text (they contain things
> like paths to certain file, etc). How do I "force" READ_ASCII to bring
> those values in as an array of strings?
>
> --j
>
|
|
|
Re: Forcing READ_ASCII output to be a set of strings... [message #43145 is a reply to message #43002] |
Mon, 14 March 2005 12:51  |
Michael Wallace
Messages: 409 Registered: December 2003
|
Senior Member |
|
|
Jonathan Greenberg wrote:
> I kinda answered my own question -- I took the read_ascii.pro that IDL
> distributes and simply changed the default behavior on this line:
>
> fieldTypesUse = REPLICATE(4L, fieldCountUse)
>
> To
>
> fieldTypesUse = REPLICATE(7L, fieldCountUse)
>
> This appears to work fine... I'm kicking IDL a request to modify this so
> it'll default to a user-defined format...
>
Um, this is dangerous. First, if you ever want to distribute this
application, or at least give it to someone else, you'll have to make
the same modification in their IDL install. It can be *very* problematic.
Second, why should the default be string rather than float? Just
because you have a need to use strings for this particular application
doesn't mean that RSI should change their defaults. For default values,
a floating point number is the best assumption to make. If the default
values don't work for you, use a template. This is why templates exist...
-Mike
|
|
|