hgexport file appears to be damaged or corrupted

조회 수: 4 (최근 30일)
Josh
Josh 2017년 7월 6일
댓글: Walter Roberson 2017년 7월 6일
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