title: reading 24 bit binary data in python not working
body: <p>I have single value(<em>val=2</em>) written as 24 bit data using matlab as:</p>
  
  <pre><code>fid = fopen('.\t1.bin'), 'wb');
  fwrite(fid, val, 'bit24', 0);
  </code></pre>
  
  <p>In a bin viewer, I can see that  data (value 2) is stored as 02 00 00.
  I need to read value as single integer in python.
  my code below does not work:</p>
  
  <pre><code>    struct_fmt = '=xxx'       
      struct_unpack = struct.Struct(struct_fmt).unpack_from
      with open('.\\t1.bin', mode='rb') as file:
          fileContent = file.read()                
          res = struct_unpack(fileContent)
  </code></pre>
  
  <p>I also tried   </p>
  
  <pre><code>val = struct.unpack('&gt;I',fileContent)
  </code></pre>
  
  <p>but it give error:</p>
  
  <blockquote>
    <p>unpack requires a string argument of length 4</p>
  </blockquote>
  
  <p>What am i doing wrong?<br>
  Thanks<br>
  sedy</p>