title: Save image in specific resolution in Matlab
body: <p>I'm trying for hours to simply output a certain plot in a specific resolution (320x240).</p>
  
  <pre><code>  xmax = 320; ymax = 240;
    xmin = 0; ymin = 0;
    figure;
    set(gcf,'position',[1060 860 320 240]);
    axis([xmin,xmax,ymin,ymax]);
    plot(someLinesAndPointsInTheRange320X240);
    saveas(gca,outName,'jpg');
    export_fig(outName);
  </code></pre>
  
  <p>Where <code>saveas</code> output the jpg image in an arbitrary resolution. <code>export_fig</code> is still showing the axes.</p>
  
  <p>Adding an <code>axis off</code> or <code>axis tight</code> doesn't help either.
  Has anyone an idea? </p>
  
  <p>UPDATE:<br>
  The problem is solved. Just for completeness here is my current solution:</p>
  
  <pre><code>  xmax = 320; ymax = 240;
    xmin = 0; ymin = 0;
    figure;
    set(gcf,'position',[1060 860 320 240]);
    subaxis(1,1,1, 'Spacing', 0.01, 'Padding', 0, 'Margin', 0);  % Removes padding
    axis([xmin,xmax,ymin,ymax]);
    plot(someLinesAndPointsInTheRange320X240);
    axis([xmin,xmax,ymin,ymax]);
  
    set(gca,'xtick',[],'ytick',[]); % Removes axis notation
    I = frame2im(getframe(gcf)); %Convert plot to image (true color RGB matrix).
    J = imresize(I, [240, 320], 'bicubic'); %Resize image to resolution 320x240
    imwrite(J, 'outName.jpg'); %Save image to file
  </code></pre>