Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1996
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1996

[Date Index] [Thread Index] [Author Index]

Search the Archive

Reading Binary Files

  • To: mathgroup at smc.vnet.net
  • Subject: [mg5171] Reading Binary Files
  • From: biblblak at ozemail.com.au (bibleBlack)
  • Date: Wed, 6 Nov 1996 01:34:46 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

Hi, 

I have to read data from binary 
files for analysis. Each record in the file has the following 
format according to the
manufacturer (Davis in the states) of the anenometer:

   short packedTime;                // Time of archive. 0...1440 minutes.
   short hiOutsideTemperature;      // High outside temperature in the
interval.       
   short lowOutsideTemperature;     // Low outside temperature in the interval.
   short insideTemperature;         // Average inside temperature in the
interval.
   short outsideTemperature;        // Average outside temperature in the
interval.
   short barometer;                 // Barometer at the time of the archive.
   unsigned char insideHumidity;    // Inside humidity at the time of the
archive.
   unsigned char outsideHumidity;   // Outside humidity at the time of the
archive.
   short dewPoint;                  // Derived from outside humidty and
outside t.
   unsigned short  rain;            // Rain clicks in the interval.
   unsigned char windSpeed;         // Average wind speed in the interval.
   unsigned char hiWindSpeed;       // High wind speed in the interval.
   short windChill;                 // Derived from wind speed and outside
temperature.
   unsigned char windDirection;     // Dominant wind direction in the interval
   unsigned char archiveInterval;   // Interval between archive entrys.

  A "short" is two bytes long.
  A "unsigned char" is one byte long.

I have tried to open the file as an input stream, and read record by
record of  byte - 
and get uneven length lists of integers between 0 and 255. Does anyone know 
how to make Mathematica read a file of this type so that the result is
something like:

{
    {
     time,                  (* integer in minutes *),
     windSpeed,             (* integer in miles/hour *)
     archiveInterval        (* integer in minutes *)
    },
    {
     ...,
     ...,
     ...
    },
    ...
}
    
Thanks All,
andy.white at rmit.edu.au


  • Prev by Date: Mathematica Applications Developers
  • Next by Date: Re: mathematica 3.0 comments?
  • Previous by thread: Mathematica Applications Developers
  • Next by thread: Re: mathematica 3.0 comments?