Printing Plots Does Not Work in MATLAB R2016a

This simple example works in MATLAB R2015b where I am able to click the print plot icon and successfully print the plot.
y=1:.2:10
z=2*y
figure,plot(y,z)
In R2016a the plot appears as usual - however when I click on the print plot icon I get the following error:
ERROR: Warning: HGUsingMATLABClasses will be removed in a future release. For more information about writing code that works in multiple releases, click here.
> In gobjects
In newplot (line 47)
In error (line 3)
Warning: HGUsingMATLABClasses will be removed in a future release. For more information about writing code that works in multiple releases, click here.
> In gobjects
In newplot (line 48)
In error (line 3)
 
Also modifying the simple example to include a print command:
y=1:.2:10
z=2*y
figure,plot(y,z)
print('test.pdf','-dpdf');
MATLAB produce this error:
ERROR: Warning: HGUsingMATLABClasses will be removed in a future release. For more information about writing code that works in multiple releases, click here.
> In gobjects
In newplot (line 47)
In generror (line 3)
Warning: HGUsingMATLABClasses will be removed in a future release. For more information about writing code that works in multiple releases, click here.
> In gobjects
In newplot (line 48)
In generror (line 3)
No appropriate method, property, or field 'FillPage' for class
'matlab.graphics.internal.mlprintjob'.
Error in validate (line 174)
if pj.FillPage || pj.BestFit
Error in print (line 81)
pj = validate( pj );
Error in generror (line 4)
print('test.pdf','-dpdf')
I have tried "restoredefaultpath" and I get this error:
ERROR: Error using restoredefaultpath (line 47)
MATLAB could not construct the default path due to missing files. For help, contact your system administrator or MathWorks Technical Support.
Is there a way to fix this?

 Accepted Answer

These error messages are appearing because MATLAB R2016a is sharing its install directory with another version of MATLAB.
To correct this, reinstall MATLAB R2016a so that each version has its own install directory.
This can be done in Windows 7 by performing the following steps:
1.    Uninstall MATLAB R2016a by going to Control Panel -> Programs -> Programs and Features. Then select MATLAB R2016a and click uninstall.
 
2.    Follow the steps in the following link to install MATLAB R2016a on your computer.
 
NOTE: In "Step 7: Specify the Installation Folder" of the installation guide, please select an installation folder that is not shared with other installations of MATLAB. Also in the future please ensure that you install each separate version of MATLAB into its own folder.

More Answers (0)

Categories

Products

Release

R2016a

Community Treasure Hunt

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

Start Hunting!