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

Home » Public Forums » archive » Re: Reading non-standard variable sizes
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: Reading non-standard variable sizes [message #81393 is a reply to message #81372] Fri, 07 September 2012 20:49 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Friday, September 7, 2012 5:23:15 PM UTC-4, Mike Galloy wrote:
> On 9/7/12 2:44 PM, Brian J. Daniel wrote:
>
>> I'm attempting to read values from a binary file with some strange variable formats. Specifically, I have a field of data that uses 9 bytes. No IDL data format has 9 bytes. I can do the following:
>
>>
>
>> data = bytarr(9)
>
>> ReadU, lun, data
>
>>
>
>> And lun will be ready to read the next variable, but how do I convert the 9 byte variable into a single 8-byte double number?
>
>>
>
>> Unfortunately, I can't change the format of this data because its a standard. Thanks for your interest.
>
>>
>
>> -Brian
>
>>
>
>
>
> Check out the DOUBLE function. I think you want something like:
>
>
>
> d = double(data, 0)
>
>
>
> or
>
>
>
> d = double(data, 1)
>
>
>
> depending on which 8 bytes of the 9 bytes are used.
...

And then pray to gods of endianness. A sacrifice at the altar of SWAP_ENDIAN may allow you to receive your wish.

Craig
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: Off-kilter z-axis label in function graphics?
Next Topic: IDLdoc 3.5 released

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

Current Time: Thu Oct 16 11:15:47 PDT 2025

Total time taken to generate the page: 0.40326 seconds