Thanks very much Sven for a very useful code. I'm using it to convert polygons from shapefiles into raster masks for extracting pixels from GeoTIFF files. mpoly2mask is about 100 times faster than anything I came up with.
Thanks for the response. It has occured to me that the resolution can be set relative to native by just resizing the image prior to display then using the -native switch. Rather than modifying the function, perhaps add a note to your website for people who are slow on the uptake like me?
Great function(s) - thanks Oliver. It works very well in concert with 'maximize.m'.
Like so many others I'm at a loss to understand why such functionality isn't built-in to MATLAB. I had reached the point of saving my images as MATLAB 'fig' format and copying and pasting into other documents to try to preserve some quality. I have one small, almost insignificant, suggestion:
Could a additional resolution option be included so that resolution can be specified as a percentage of 'native' rather than only relative to the size on screen? Is there a simple way to do this already using the -r switch?
I've also noticed that MATLAB (Win7 64-bit R2010b) produces a scary warning "Warning: print2array generating a 185.1M pixel image. This could be slow and might also cause memory problems." when in fact the image size is one-tenth that with -m set to 10. It's not important but had me worried until I realised it was bunkum.