Re: Vectorized STRMID ( was Re: Selecting odd/even numbered files) [message #30052] |
Wed, 03 April 2002 15:38 |
Wayne Landsman
Messages: 117 Registered: January 1997
|
Senior Member |
|
|
David Fanning wrote
> You wouldn't be up for writing a string processing tutorial
> (a la JD's Dimensional Juggling tutorial) would you, Wayne?
> I can't be the only one who gets totally confused every time
> I have to do something like this.
I'll put it on the "to do"list -- so maybe it will be done in a couple of months...
Meanwhile, here's a one line solution to the orignal problem (of selecting only
even numbered files), by specifying that the last character must be an even number
files = file_search('*[02468].ext')
The above works in V5.5 (when file_search() was introduced as a replacement for
findfile()) . For Unix systems and any version of IDL one can also write
files = findfile('*[02468].ext')
but, unlike the file_search() method,I don't believe that this method works for
non-Unix systems.
Cheers, --Wayne landsman@mpb.gsfc.nasa.gov
|
|
|
Re: Vectorized STRMID ( was Re: Selecting odd/even numbered files) [message #30054 is a reply to message #30052] |
Wed, 03 April 2002 13:24  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Wayne Landsman (landsman@mpb.gsfc.nasa.gov) writes:
> The reason you were getting 4x4 output arrays is that the vectorized STRMID is
> sometimes *too* powerful -- it can both extract many substrings from a single
> string, and extract substrings from many strings. Therefore, the position
> parameter has to be REFORMed into a 2-d array.
Well, there you go. :-)
You wouldn't be up for writing a string processing tutorial
(a la JD's Dimensional Juggling tutorial) would you, Wayne?
I can't be the only one who gets totally confused every time
I have to do something like this.
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|