MATLAB: How to increase the resolution of a frame produced by HARDCOPY

MATLAB

I am using the HARDCOPY function to capture the cdata values which is then converted to a frame using the IM2FRAME function. I would like to be able to increase the resolution of the frame captured.
hfig = figure(1);
surf(peaks);
cdata = hardcopy(hfig, '-Dopengl', '-r0');
frame = im2frame(cdata);

Best Answer

The default resolution is set to 84dpi as stated by the third input to the HARDCOPY function '-r0'. To increase the resolution to lets say 150 dpi, modify the call to HARDCOPY as follows:
cdata = hardcopy(hfig, '-Dopengl', '-r150');