Print error only with PC/matlab 2019a

20 次查看(过去 30 天)
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?

采纳的回答

Kritika Bansal
Kritika Bansal 2019-11-5
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 个评论
Walter Roberson
Walter Roberson 2019-11-5
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 2019-11-7
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!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by