Error using print (line 82)

5 views (last 30 days)
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 Method)

at Source)

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

at com.mathworks.hg.uij.ExportClipboardHelper.copyToClipboard(

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$

at com.mathworks.mvm.context.ThreadContext.callWithContext(

at com.mathworks.mvm.context.MvmContext.callWithContext(

at com.mathworks.jmi.AWTUtilities$Invoker$3.runWithOutput(

at com.mathworks.jmi.AWTUtilities$Invoker$2.watchedRun(

at com.mathworks.jmi.AWTUtilities$

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$ Source)

at java.awt.EventQueue$ Source)

at Method)

at$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 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 on 19 Oct 2018
Nope. Sorry. It is still a mystery.


Find more on Environment and Settings in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by