title: Writing binary files in QT and reading in matlab
body: <p>Trying to do the simplest thing ever. Write a number in QT in binary mode (unsigned 16) and read the file in matlab. I use Append mode since I will be adding numbers to the file in the future But can't seem to do this right.</p>
  
  <p>This is the QT code:</p>
  
  <pre><code>QFile f("C:\\temp.dat");
  f.open(QIODevice::WriteOnly | QIODevice::Append)
  QDataStream out(&amp;f);
  out&lt;&lt;quint16(270);
  f.close();
  </code></pre>
  
  <p>And this is the Matlab code:</p>
  
  <pre><code>fid = fopen('C:\\temp.dat');
  F_nums = fread(fid,1,'*uint16');
  fclose(fid);
  </code></pre>
  
  <p>Seems very simple but it reads the numbers wrongly...</p>
  
  <p>Thank you!</p>