How can I produce a high resolution image with the "Copy Figure" option using MATLAB on Mac OS X?

6 views (last 30 days)
I want to use "Copy Figure" option in a figure window to copy a high quality/vector image to the clipboard/pasteboard.
Also I want to copy the image with transparent background, onto the clipboard.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 18 Nov 2016
* Scope of this solution *
This solution concerns the Mac platform only, with the following software versions only:
MATLAB versions:
- R2011a
- R2011b
- R2012a
- R2012b
Mac OS X versions:
10.6 (Snow Leopard)
10.7 (Lion)
10.8 (Mountain Lion)
Do not apply the steps described in this solution to any other combination of MathWorks and Apple software.
* Description of the issue *
If you use the copy figure edit menu option in a figure window,
1. The image placed on clipboard is low resolution bitmap image.
2. The image placed on the clipboard contains part of the desktop when the figure window is docked into MATLAB desktop window.
3. There is no image pasted onto the clipboard, if the figure window is on a secondary monitor.
Applying this patch would enable you to copy high quality/vector image to the clipboard. The patch reverts to a bitmap image when a vector image is not possible. Also this patch lets you copy a figure to the clipboard, when the figure window is on a secondary monitor or docked into MATLAB desktop.
* To apply the patch *
Below are the steps to follow in order to apply the patch:
Step 1. Download the appropriate patch for your MATLAB version and Mac OS X version, attached to this Solution (see bottom):
copyfigurePatch_R2012_MACOSX.patch for MATLAB version R2012a & R2012b on Mac OS X 10.7 and OS X 10.8.
copyfigurePatch_R2012_MACOSX6.patch for MATLAB version R2012a & R2012b on Mac OS X 10.6.
copyfigurePatch_R2011_MACOSX.patch for MATLAB version R2011a & R2011b on Mac OS X 10.7 and OS X 10.8.
copyfigurePatch_R2011_MACOSX6.patch for MATLAB version R2011a & R2011b on Mac OS X 10.6.
These instructions assume you downloaded the patch file to the default location Safari uses, namely the “Downloads” folder of your home folder.
Step 2. Start MATLAB, if it is not already running.
Step 3. Unzip the patch files.
On the MATLAB Command Prompt, execute the following:
cd(matlabroot)
Assuming that the patch file is in the "Downloads" folder of your home directory, below is the command to be executed at the MATLAB Command Prompt, in order to unzip the patch files and automatically place them in the appropriate directories under your MATLAB installation.
For Mac OS X 10.7 and above
!unzip -o ~/Downloads/copyfigurePatch_<release_year>_MACOSX.patch
For Mac OS X 10.6
!unzip -o ~/Downloads/copyfigurePatch_<release_year>_MACOSX6.patch
where <release_year> needs to be replaced depending on the patch downloaded
Step 4. Rebuild the file system path cache, for the patch to take effect, by executing the following commands on the MATLAB Command Prompt and clear any classes that may have been loaded in the memory
 
rehash toolboxcache
clear classes
"Copy Figure" menu option in figure window should now be configured to use the patched files.
* Troubleshooting *
If, after installing the patch, you get an error such as this:
  ERROR: Undefined function 'pfcopyfigure' for input arguments of type 'double'. ... Error while evaluating uimenu Callback
Make sure the files pfcopyfigure.p and pfCopyEPSToClipboard.mexmaci64 files are on the path. Execute the following to verify the functions are on the path.
which -all pfcopyfigure
which -all pfCopyEPSToClipboard
* To uninstall the patch *
Execute the following commands on MATLAB Command Prompt
cd(matlabroot)
!rm toolbox/matlab/uitools/pfcopyfigure.p
!rm toolbox/matlab/uitools/pfCopyEPSToClipboard.mexmaci64
For R2011a through R2012b only
>>!rm toolbox/matlab/uitools/editmenufcn.p
At the end, rebuild the toolbox path cache and clear any classes that may have been loaded in the memory
rehash toolboxcache
clear classes
* Note *
The patches attached to this solution can be used with any MATLAB release mentioned in the scope of this solution (see above).

More Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Products


Release

No release entered yet.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!