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

Home » Public Forums » archive » Re: Imaginary is narrow minded
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: Imaginary is narrow minded [message #9848 is a reply to message #9846] Tue, 02 September 1997 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Brian Jackel writes:

> <Rant>
> I'm stuck with IDL 4.0, and was wondering if the snazzy new version
> still gives this stupid error
>
> % IMAGINARY: Operand must be of complex type:
>
> Alternatively, I'd love to know _why_ it can't just return a zero value.
> Sometimes the argument is going to be real, and it irritates me to add
> the extra call to make sure the argument is complex. IDL functions are
> usually pretty clever about dealing with variable input types, but not here.
> </Rant>

Oh, dear, it's one of those days, apparently. Here, Brian, something to
cheer you up.

FUNCTION Type, variable
types = ['UNDEFINED', 'BYTE', 'INTEGER', 'LONG', 'FLOAT', $
'DOUBLE', 'COMPLEX', 'STRING', 'STRUCTURE', $
'DCOMPLEX', 'POINTER', 'OBJECT']
s = Size(variable)
RETURN, types(s(s(0) + 1))
END

IF Type(thatThing) EQ 'COMPLEX' THEN thisThing=Imaginary(thatThing)$
ELSE thisThing = 0

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting
Customizable IDL Programming Courses
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Size of variables in bytes?
Next Topic: IDL -> MPEG

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

Current Time: Sun Oct 12 08:00:36 PDT 2025

Total time taken to generate the page: 1.51870 seconds