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

Home » Public Forums » archive » Re: Question about user input in IDL
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: Question about user input in IDL [message #67178] Thu, 09 July 2009 14:46 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Joanna writes:

> Hi! I'm a very, very amateur programmer, much less IDL user... so if
> this question doesn't even make sense, I wouldn't be surprised!
>
> Okay, so I'm writing a code that requires the user to input a string.
> I have this:
>
> x=''
> read,'Enter first type (Example: alpha, beta, gamma): ',x
> print,x
>
> So, when I execute this, and someone chooses alpha, then alpha gets
> printed on the screen. However, within the program, I've read in some
> data using rdfloat,'filename.txt',alpha,beta,gamma. So, really I want
> to define x as alpha which then refers to this column of data, so that
> when it gets to the print,x it actually prints this column of data. I
> don't even know if this is possible, but if there's a way to do it, I
> would be ecstatic!

How about something like this:

rdfloat, 'filename.txt', alpha, beta, gamma
x = ''
read,'Enter first type (Example: alpha, beta, gamma): ',x
CASE StrLowCase(x) OF
'alpha': Print, alpha
'beta': Print, beta
'gamma': Print, gamma
ELSE: Print, 'I have no idea what you want!!'
ENDCASE

Cheers,

David


--
David Fanning, Ph.D.
Coyote's Guide to IDL Programming (www.dfanning.com)
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: Are user-defined private methods possible?
Next Topic: findgen anomaly?

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

Current Time: Wed Oct 08 19:24:06 PDT 2025

Total time taken to generate the page: 0.00391 seconds