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

Home » Public Forums » archive » Byte to Real conversion
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: Byte to Real conversion [message #14341 is a reply to message #14340] Thu, 18 February 1999 00:00 Go to previous messageGo to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Michael A. Wirth (s9601460@131.170.8.11) writes:

> I am reading some data in from an Magnetic Resonance image which stores
> information about the image in
> a 14336 byte header. I want to extract some of the data from this header
> and am having a problem
> with converting data to integers and reals. The integers are 2-bytes and
> the reals 4-bytes in length. How does
> one convert 4 bytes into a real number?

If the variable number is a four-element byte array holding
the floating point number, you convert it back to a float
like this:

real_num = Float(number, 0)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Looking for co-occurrence code
Next Topic: Re: PV-WAVE and possibly IDL color maps

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

Current Time: Sat Oct 11 08:38:31 PDT 2025

Total time taken to generate the page: 1.03993 seconds