MATLAB: Plotting figures – pixel depth

MATLABplotting

Dear all,
How can I improve my figures in order to avoid the pixelation when zooming in them?
I'm using this function for creating the figures (mostly automatically generated by matlab) but I couldn't obtain the desired results.
I have tried maximizing the window, but I don't like the proportions of the text regarding the figure.
Thanks in advance,
Diego
function createfigure(A, B, C)
%CREATEFIGURE(A,B,C)
% A: vector of x data
% B: vector of y data
% C: table name
% Auto-generated by MATLAB on 04-Dec-2012 03:52:43
% screen_size = get(0, 'ScreenSize');
% Create figure
figure1 = figure;
% set(figure1, 'Position', [0 0 screen_size(3) screen_size(4) ] );
% Create axes
axes1 = axes('Parent',figure1,'YGrid','on','XGrid','on');
box(axes1,'on');
hold(axes1,'all');
% Create title
disp(inputname(1))
t = ({[C{1}, ' - ', inputname(2), ' vs. ', inputname(1) ]});
title(t)
% Create plot
plot(A,B,'Marker','.','LineStyle','none',...
'DisplayName', {[inputname(2) ' vs. ' inputname(1)]});
% Create xlabel
xlabel(inputname(1));
% Create ylabel
ylabel(inputname(2));
X=getframe(gcf);
imwrite(X.cdata, [C{1}, '_', inputname(2), '_vs_', inputname(1),'.png'])

Best Answer

You could give this a try (from the file exchange, by O. Woodford); I have extremely good experiences with this code. http://www.mathworks.nl/matlabcentral/fileexchange/23629-exportfig
It exports figures in the current figure window at higher resolutions.
After adding this file in your matlabpath, you should replace the latest two lines from your code into:
eval([['export_fig ' C{1}, '_', inputname(2), '_vs_', inputname(1),'.png']]