Error when using exportgraphics function to save large vector graphics with transparency
8 views (last 30 days)
Show older comments
When I tried to save a large vector graphic with transparency information using the exportgraphics function on my PC, an error occurred.
MATLAB version: 9.12.0.2529717 (R2022a) Update 8
Operating system: Microsoft Windows 10 Pro Version 10.0 (Build 19045)
Java version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
After plotting a large 3D vector graphic with complex perspectives and transparency relationships in a figure, I attempted to run the following code to save the figure:
exportgraphics(gca, 'picture1.emf', 'BackgroundColor', 'none', 'ContentType', 'vector')
However, the program threw an error.
The error message was:
Problem while processing in an OutputHelper. java.nio.file.NoSuchFileException:
C:\Users\room250\AppData\Local\Temp\emf6382030724281275533.tmp
com.mathworks.hg.util.OutputHelperProcessingException: Problem while processing in an
OutputHelper. java.nio.file.NoSuchFileException:
C:\Users\room250\AppData\Local\Temp\emf6382030724281275533.tmp
at com.mathworks.hg.util.HGVectorOutputHelper.close(HGVectorOutputHelper.java:245)
Caused by: com.mathworks.hg.print.OutputProcessingException: java.nio.file.NoSuchFileException:
C:\Users\room250\AppData\Local\Temp\emf6382030724281275533.tmp
at com.mathworks.hg.print.MWEMFVectorStrategy.endJob(MWEMFVectorStrategy.java:144)
at com.mathworks.hg.util.HGVectorOutputHelper.close(HGVectorOutputHelper.java:241)
Caused by: java.nio.file.NoSuchFileException:
C:\Users\room250\AppData\Local\Temp\emf6382030724281275533.tmp
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:230)
at java.nio.file.Files.newByteChannel(Files.java:361)
at java.nio.file.Files.newByteChannel(Files.java:407)
at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384)
at java.nio.file.Files.newInputStream(Files.java:152)
at java.nio.file.Files.copy(Files.java:3068)
at com.mathworks.hg.print.MWEMFVectorStrategy.endJob(MWEMFVectorStrategy.java:142)
... 1 more
I tried running MATLAB as an administrator and on a PC with higher memory, but the error persisted, and the error message remained the same. In addition, I checked the available storage space on my computer, and I have at least 390 GB of free space.
When I saved the same figure without transparency information as an image (using
exportgraphics(gca, 'picture1.emf', 'BackgroundColor', 'none', 'ContentType', 'image')
), the exportgraphics function worked correctly.
Furthermore, I plotted a smaller image and tried again to save it using
exportgraphics(gca, 'picture1.emf', 'BackgroundColor', 'none', 'ContentType', 'vector')
, and the result was correct.
So, it seems that the exportgraphics function may not support saving larger images, or is there another reason?
Answers (1)
埃博拉酱
on 26 Jan 2025
Edited: 埃博拉酱
on 26 Jan 2025
我使用了你提供的文件,测试了你的第一行代码,但是在更新的MATLAB版本和操作系统环境上:
------------------------------------------------------------------------------------------------
MATLAB 版本: 25.1.0.2833191 (R2025a) Prerelease Update 2
MATLAB 许可证编号: Prerelease
操作系统: Microsoft Windows 11 专业版 Insider Preview Version 10.0 (Build 27774)
Java 版本: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
------------------------------------------------------------------------------------------------
并没有遇到任何错误,成功输出了EMF,并且可以插入到Word中查看。你或许需要尝试更新的MATLAB版本,以包含潜在的bug修复。
0 Comments
See Also
Categories
Find more on Printing and Saving in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!