MATLAB Answers

Error using print (line 82)

5 views (last 30 days)
ArchNW
ArchNW on 27 May 2017
Answered: ArchNW on 19 Oct 2018

I am getting the following error intermittently while printing figures off to Excel workbooks. The error is not consistent. The script writes multiple figures to multiple pages of a workbook then goes back and starts the process over with new data. The program works on a workstation running Windows XP using Matlab 2014a. It is throwing the error on a Windows 10 PC using Matlab 2016b and 2017a. Basic code updates for differing Matlab versions have been made to the figure generating code. Frustratingly for tracking down the source of the error, sometimes it will run through no problem. For instance, the code had run correctly 7 times before throwing the error below. Norton antivirus is not being used, noted here because that seems to be something that will cause problems using clipboard. The error report runs:

Error using print (line 82) Java exception occurred: java.lang.IllegalStateException: cannot open system clipboard

at sun.awt.windows.WClipboard.openClipboard(Native Method)

at sun.awt.windows.WClipboard.setContentsNative(Unknown Source)

at sun.awt.datatransfer.SunClipboard.setContents(Unknown Source)

at com.mathworks.hg.uij.ExportClipboardHelper.copyToClipboard(ExportClipboardHelper.java:107)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.mathworks.jmi.AWTUtilities$Invoker$3$1.call(AWTUtilities.java:525)

at com.mathworks.mvm.context.ThreadContext.callWithContext(ThreadContext.java:105)

at com.mathworks.mvm.context.MvmContext.callWithContext(MvmContext.java:113)

at com.mathworks.jmi.AWTUtilities$Invoker$3.runWithOutput(AWTUtilities.java:522)

at com.mathworks.jmi.AWTUtilities$Invoker$2.watchedRun(AWTUtilities.java:475)

at com.mathworks.jmi.AWTUtilities$WatchedRunnable.run(AWTUtilities.java:436)

at java.awt.event.InvocationEvent.dispatch(Unknown Source)

at java.awt.EventQueue.dispatchEventImpl(Unknown Source)

at java.awt.EventQueue.access$200(Unknown Source)

at java.awt.EventQueue$3.run(Unknown Source)

at java.awt.EventQueue$3.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.run(Unknown Source)

Error in MCA_Univariate_Tbl_Long_WOBD (line 731) print(gcf, '-dbitmap','-r0');

Error in run (line 86) evalin('caller', [script ';']);

Error in MCA_Run_Control_WOBD_A (line 435) run('MCA_Univariate_Tbl_Long_WOBD.m');

  1 Comment
Derek Hutton
Derek Hutton on 6 Aug 2018
I am having this same issue. It started with I upgraded to Windows 10 and MATLAB 2017b. Did you ever find a resolution?

Sign in to comment.

Answers (1)

ArchNW
ArchNW on 19 Oct 2018
Derek,
Nope. Sorry. It is still a mystery.

Community Treasure Hunt

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

Start Hunting!

Translated by