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

Home » Public Forums » archive » Re: checking the data type in IDL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: checking the data type in IDL [message #67879] Wed, 09 September 2009 01:09
Chris[6] is currently offline  Chris[6]
Messages: 84
Registered: July 2008
Member
On Sep 7, 11:25 pm, Dandelion <dandel...@gmx.com> wrote:
> On Sep 8, 12:30 am, "b.a" <u4565...@anu.edu.au> wrote:
>
>> Hi,
>
>> In the middle of my IDL program, I need to check the type of a
>> variable in order to decide what to do with it. I mean, I have to
>> check whether variable1 is a STRING or FLOAT (for example). Like this:
>
>> IF variable1 "is STRING' do .....
>> else do ...
>
>> Of course "help, variable1" will not help as it shows the answer on
>> the consol and I can't use it that way. If anybody knows how to do so,
>> please let me know. Thanks.
>
>> Cheers
>
> Use the SIZE function with the TYPE keyword to return the type code
> for an IDL variable. If you search -data type- or -size- in the IDL
> help, you will find more details.
>
> ~D

I also like size(x, /tn), which returns the data type as a word

chris
Re: checking the data type in IDL [message #67890 is a reply to message #67879] Tue, 08 September 2009 02:25 Go to previous message
Dandelion is currently offline  Dandelion
Messages: 1
Registered: September 2009
Junior Member
On Sep 8, 12:30 am, "b.a" <u4565...@anu.edu.au> wrote:
> Hi,
>
> In the middle of my IDL program, I need to check the type of a
> variable in order to decide what to do with it. I mean, I have to
> check whether variable1 is a STRING or FLOAT (for example). Like this:
>
> IF variable1 "is STRING' do .....
> else do ...
>
> Of course "help, variable1" will not help as it shows the answer on
> the consol and I can't use it that way. If anybody knows how to do so,
> please let me know. Thanks.
>
> Cheers

Use the SIZE function with the TYPE keyword to return the type code
for an IDL variable. If you search -data type- or -size- in the IDL
help, you will find more details.

~D
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Reading ASCII Data Files in IDL
Next Topic: idl_lmgrd memory leak

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

Current Time: Wed Oct 08 13:42:16 PDT 2025

Total time taken to generate the page: 0.00629 seconds