Re: checking the data type in IDL [message #67879] |
Wed, 09 September 2009 01:09 |
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  |
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
|
|
|