Print error only with PC/matlab 2019a

23 views (last 30 days)
When I try to save a figure as PDF, everything works perfectly on my work computer (Matlab 2018b on an iMac). However, the following line does not work when I try to run it on my Windows 10 PC, running matlab 2019a.
pdfname = [SubjectID{i} '_3 Block ITC plot_channels' num2str(plotchan) ];
print('-dpdf', pdfname);
I get the following error:
Error using print (line 82)
There was a problem while generating the output: Problem while processing in an OutputHelper. .\47_3 Block ITC plot_channels1 2 3 4 5 6
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32.pdf (The system cannot find the path
specified)
com.mathworks.hg.util.OutputHelperProcessingException: Problem while processing in an OutputHelper. .\47_3 Block ITC plot_channels1 2 3 4
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32.pdf (The system cannot find the path
specified)
at com.mathworks.hg.util.HGVectorOutputHelper.open(HGVectorOutputHelper.java:74)
Caused by: com.mathworks.hg.print.OutputProcessingException: .\47_3 Block ITC plot_channels1 2 3 4 5 6 7 8 9 10 11 12 13 14
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32.pdf (The system cannot find the path specified)
at com.mathworks.hg.print.BaseVectorStrategy.open(BaseVectorStrategy.java:30)
at com.mathworks.hg.util.HGVectorOutputHelper.open(HGVectorOutputHelper.java:64)
Error in Kid_SL_Freq_Tag_v2 (line 1097)
print('-dpdf', pdfname);
Also, when I try to open the PDF files on my windows laptop that were created on the iMac, they won't open.
Anyone have any suggestions on how to fix this?

Accepted Answer

Kritika Bansal
Kritika Bansal on 5 Nov 2019
Hi,
The problem seems to be with the file name you are using to generate the pdf.
According to the documentation of the print function, the length of the filename including the path depends on the operating system and typically should not exceed 128 characters. The usage of num2str(plotchan) doesn’t seem to be right in the following command.
pdfname = [SubjectID{i} '_3 Block ITC plot_channels' num2str(plotchan) ];
You can try changing the filename to make this work.
  2 Comments
Walter Roberson
Walter Roberson on 5 Nov 2019
254 characters including path should work on all operating systems that matlab is supported on. But there is a difference between "should" and "does". Reducing the size of the file name is probably a good idea.
Christine
Christine on 7 Nov 2019
Thank you for your answers! It worked once I got rid of "num2str(plotchan)". Such a simple fix that I puzzled over for too long!

Sign in to comment.

More Answers (0)

Categories

Find more on Simulink Functions in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!