hgexport file appears to be damaged or corrupted
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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
0 comentarios
Respuestas (1)
Walter Roberson
el 6 de Jul. de 2017
"hgexport(fig,filename) writes figure fig to the EPS file filename."
You have a EPS file named as a .bmp
2 comentarios
Walter Roberson
el 6 de Jul. de 2017
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 ?
Ver también
Categorías
Más información sobre Printing and Saving en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!