Re: procedure in case statement [message #82139 is a reply to message #82049] |
Mon, 19 November 2012 07:52   |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
Hmm. Not really. This is what I get (on the command line):
IDL> read,rot,prompt='rot via proc one or two? (1 or 2)'
rot via proc one or two? (1 or 2)3
IDL> help, rot
ROT FLOAT = 3.00000
So, you can see it assumes "rot" is a float by default.
Now let's try a string:
IDL> read,rot,prompt='rot via proc one or two? (1 or 2)'
rot via proc one or two? (1 or 2)proc_one
% READ: Input conversion error. Unit: 0, File: <stdin>
% Execution halted at: $MAIN$
Oops. So, DavidF was correct. You have to cast the variable as a string
before you use it as such:
IDL> rot=""
IDL> read,rot,prompt='rot via proc one or two? (1 or 2)'
rot via proc one or two? (1 or 2)proc_one
IDL> help, rot
ROT STRING = 'proc_one'
IDL> print, !version
{ x86 linux unix linux 8.2 Apr 10 2012 32 64}
cheers,
paulv
On 11/19/12 10:46, hannah_ue@web.de wrote:
> thanks for your answer. i do it exactly like you suggested, but always get the error "read: input conversion error. unit: 0, file:<stdin>"
> do you have an idea what could be wrong?
>
> thanks, hannah
|
|
|