Mathematica 9 is now available
Student Support Forum
Student Support Forum: 'Import data from binary file' topicStudent Support Forum > General > "Import data from binary file"

Next Comment >Help | Reply To Topic
Author Comment/Response
Drew Procyk
04/16/02 11:56am

I need to import data from a binary file created by SIMION 7.0 but am having some trouble. From the SIMION manual, the data file has the following format: Header {long, long, double, long, long, long, long} and data {double}, all "assume C conventions". Here's what I've written to import the file:
<< Utilities`BinaryFiles`
stream = OpenReadBinary["d:/testdata/einzel.pa1"]
header = ReadBinary[
stream, {SignedInt32, SignedInt32, Double, SignedInt32, SignedInt32,
SignedInt32, SignedInt32}, ByteOrder -> LeastSignificantByteFirst]
data = ReadListBinary[stream, Double, ByteOrder -> LeastSignificantByteFirst]

The long data types from the header read in fine, but the double type in both the header and data are garbled with the accompanying error:
ReadBinary::nonnormal : Warning: Binary value 109537/70368744177664 was not in the normalized floating point format; value may not be correct.

Because the long types in the latter portion of the header are OK and the total number of data points is correct, I assume that the byte length of the double is correct, but there is something else wrong.

Any thoughts?

URL: ,

Subject (listing for 'Import data from binary file')
Author Date Posted
Import data from binary file Drew Procyk 04/16/02 11:56am
Re: Import data from binary file Henry Lamb 04/19/02 02:59am
Next Comment >Help | Reply To Topic