hgexport file appears to be damaged or corrupted

2 次查看(过去 30 天)
I have a figure that I am formatting in my script which I would like to save as a jpg/bmp/png from the script, but preserve the formatting.
I defined the figure and formatting:
fig1=figure('units','normalized','outerposition',[0 0 1 1]);
then plotted several things, and tried to output:
hgexport(fig1,'Test.bmp','units','normalized','outerposition',[0 0 1 1])
The figure is created as a bmp in the working directory, but when I try to open the image I get the message "Windows Photo Viewer can't open this picture because the file appears to be damaged, corrupted, or is too large". I get the same message if trying to open the image in paint or powerpoint.
Is there some other way to save the figure as an image from the script and preserve the formatting? I have also tried saveas and print, but the formatting/size is wrong. I am on R2015b.
Thanks

回答(1 个)

Walter Roberson
Walter Roberson 2017-7-6
"hgexport(fig,filename) writes figure fig to the EPS file filename."
You have a EPS file named as a .bmp
  2 个评论
Josh
Josh 2017-7-6
Is there a way to save my figure to an image file other than Eps and preserve the format?
Walter Roberson
Walter Roberson 2017-7-6
No, not unless you count a .fig file as being an "image file". Every other image file type is static and will lose some information compared to what MATLAB knows.
If you were to indicate particular information that needed to be preserved, there is a possibility that someone might have ideas.
Did you try export_fig from the File Exchange ?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Printing and Saving 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by