How to eliminate 'print -dmeta' crash?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
K E
el 28 de Jun. de 2016
Comentada: K E
el 8 de Jul. de 2016
Is there a way to either (a) prevent 'print -dmeta' from crashing Matlab, or (b) to preserve a figure window's aspect ratio when using 'print -dbitmap'?
Background: I am having trouble with clipboard copying within wordreport. I can choose either 'print -dmeta' or 'print -dbitmap' to copy Matlab figures to the clipboard then paste them into Word. However (a) -dmeta causes Matlab to crash (error below), and (b) -dbitmap loses the figure window's aspect ratio. For (a) I have the recommended Java version installed (Version 8 Update 91), and for (b) "Match figure screen size" is checked in Preferences > MATLAB > Figure Copy Template > Copy Options. I am using Windows 7 and R2015b. Any workarounds appreciated.
Error using print (line 212)
There was a problem while generating the output: Java exception occurred:
com.mathworks.hg.util.OutputHelperProcessingException: Problem while processing in an OutputHelper. Clipboard
copy failed.
at com.mathworks.hg.util.HGVectorOutputHelper.close(HGVectorOutputHelper.java:259)
Caused by: java.io.IOException: Clipboard copy failed.
at com.mathworks.hg.uij.ExportClipboardHelper.copyToClipboard(ExportClipboardHelper.java:121)
at com.mathworks.hg.util.HGVectorOutputHelper.close(HGVectorOutputHelper.java:257)
Error in wordreport/AddFigure_c (line 524)
print -dmeta
108 ex.throwAsCaller();
0 comentarios
Respuesta aceptada
Prasad Mendu
el 7 de Jul. de 2016
Editada: Prasad Mendu
el 7 de Jul. de 2016
This error "Error using print" when printing in '-dmeta' format using MATLAB R2015b could be because of a bug present in it which is addressed in MATLAB R2016a. If it is not possible for you to upgrade the MATLAB, you can refer to the information given below.
I have found a piece of code on the File Exchange that is able to copy the figure to the clipboard which can be used as a possible workaround. There is a small issue in that the area copied includes the title bar of the figure window, but you can also interactively select an area to copy to the clipboard, or crop the images in post-processing.
The File Exchange submission can be found at the following link:
After one small change, however, I had no problems with this file. I had to change one line in order to make this submission work: I changed line 765 from:
cb = getDefaultToolkit.getSystemClipboard;
to:
cb = java.awt.Toolkit.getDefaultToolkit.getSystemClipboard;
After doing this, I called the function with:
>> screencapture('handle', gcf, 'target', 'clipboard')
in order to copy the entire figure (including window title bar) to the clipboard, and
>> screencapture('target', 'clipboard')
in order to interactively select a section of the figure to copy.
Más respuestas (0)
Ver también
Categorías
Más información sobre Environment and Settings en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!