MATLAB Answers

Chad Greene

Using export_fig with publish

Asked by Chad Greene
on 20 Aug 2014
Latest activity Commented on by Sean de Wolski
on 22 Aug 2014

I've been using the publish feature a lot lately, but the figures it produces are absolutely lousy. Is there a way to tell publish to use export_fig? My only workaround now is exporting manually after running publish, then overwriting the figures generated by publish.



No products are associated with this question.

1 Answer

Answer by Sean de Wolski
on 20 Aug 2014

You could export_fig to save it to a file and then use the image markup tag to add it to the published report.

export_fig('.\html\pica.png') % save to html directory
close % make sure it's not there to be snapped
%  <<pica.png>>


That's a clever solution. Is there a way to suppress the export_fig and close lines from appearing in the output html? I'd like to give the reader a final html document with content that doesn't get obfuscated by extra little lines that make the publishing work. Artifacts like export_fig and close seem equivalent to STOP in a telegram. Charming, perhaps, but a bit distracting.

I don't know of anyway outside of turning off code capture altogether.

If you're publishing to html, you could probably regexp the file after. I do this to remove the contents section on my blog posts.

Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!