title: Write a uint16 image
body: <p>How can I write an image of datatype <code>uint16</code> to a file in MATLAB? I try to write to the file using the following command, but it gives me an error</p>
  
  <pre><code>imwrite(pimg, 'h44', 'jpg')
  </code></pre>
  
  <blockquote>
    <p>Error using writejpg>set_jpeg_props (line 183)<br>
    UINT16 image data requires bitdepth specifically set to
    either 12 or 16.<br>
    Error in writejpg (line 49)<br>
    props = set_jpeg_props(data,varargin{:});<br>
    Error in imwrite (line 472)<br>
            feval(fmt_s.write, data, map, filename,
            paramPairs{:});<br>
    Error in image16bit (line 666)<br>
    imwrite(imgnew1,'h44','jpg' );</p>
  </blockquote>