title: How to convert fixed point data to byte array in matlab
body: <p>I have the following piece of code related to conversion of fixed point to byte array in matlab:</p>
  
  <pre><code>R2 = fi(R1,1,16,15); % R1 is a 2x2 matrix which contains floating point data in the range [-1,1]
  
  [m,n] = size(R2);
  
  % I tried this code.
  % R3 = repmat('  ',m,n*2);
  % temp = R2(1,1);
  % R3(1,1) = temp.hex
  </code></pre>
  
  <p>but failed.</p>
  
  <p>How can I convert the R2 data into a byte array R3.
  Each element in R3 matrix must be the hexadecimal representation of corresponding elements in R2.</p>