comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Why doesn't this work?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Why doesn't this work? [message #7834 is a reply to message #7833] Thu, 09 January 1997 00:00 Go to previous message
joseph.b.gurman is currently offline  joseph.b.gurman
Messages: 15
Registered: October 1995
Junior Member
In article <32D58AF7.51A8@cfht.hawaii.edu>, Tim Abbott
<tmca@cfht.hawaii.edu> wrote:

> Can anyone tell me why this doesn't work?
>
> I need to extract the four numbers from the string "[123:456,246:135]"
>
> Here is the code segment I'm trying to use:
> IDL> str = "[123:456,246:135]"
> IDL> reads,str,x1,x2,x3,x4,format='(4(1X,I0))'
^^
> % Unable to apply format code I to input: "]".
> % Execution halted at: $MAIN$
> IDL> print,x1,x2,x3
> 123.000 246.000 0.00000
> IDL> print,x1,x2,x3,x4
> % PRINT: Variable is undefined: X4.
> % Execution halted at: $MAIN$

Tim -

It looks like it's trying to read the final "]" because you're using
I0 --- do you need to do that, or do you know that all your integer
strings will be three characters long? If so, of course, you could just
use:

IDL> reads, str , x1, x2, x3, x4, format = '(4(1X, I3))'

which gives:

IDL> print, x1, x2, x3, x4
123.000 456.000 246.000 135.000

Sorry if I'm missing the point; I thought it might have to do with the
lack of oxygen at the telescope....

Joe Gurman

--
J.B. Gurman / Solar Physics Branch/ NASA Goddard Space Flight Center/
Greenbelt MD 20771 USA / joseph.b.gurman@gsfc.nasa.gov
| Federal employees are still prohibited from holding opinions while at |
| work. Therefore, any opinions expressed herein are somebody else's. |
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: polar stereographic contour plot.
Next Topic: Q: Selection of specific plot regions

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:03:43 PDT 2025

Total time taken to generate the page: 0.00448 seconds