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

Home » Public Forums » archive » Re: type conversion
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: type conversion [message #43985] Fri, 06 May 2005 12:39
rensheu is currently offline  rensheu
Messages: 3
Registered: February 2005
Junior Member
Hi David,

Thank you so much!!

R.D.
Re: type conversion [message #43988 is a reply to message #43985] Fri, 06 May 2005 12:12 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
rensheu@yahoo.com writes:

> I have a question about type conversion in IDL.
>
> I get a float value return by IDLffDICOM object, but it is stored in
> byta[4]. Is there any way like in C as follows,
>
> char byta[4]={103, 38, 18, 68};
> float tmpv;
>
> pf = (float *)(&bytarr);
> tmpv = (float)(*pf);
>
> convert the varible from a 4 elements byte array to a float point
> variable in IDL?

Try this:

byta = [103B, 38B, 18B, 68B]
var = Float(byta, 0)

You need the offset (the second positional parameter), as
I just learned again this morning to my chagrin. :-(

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: type conversion
Next Topic: iTool Challenge Quiz

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

Current Time: Thu Oct 09 20:00:18 PDT 2025

Total time taken to generate the page: 0.48127 seconds