Export figure to Microsoft Outlook

K E asked on 22 Nov 2011
Latest activity: Comment by Kathleen on 24 Nov 2011

Seeking a good way to email plots to my coworkers via Outlook. The following are not satisfactory: 1) From Matlab figure window, choose Edit > Copy Figure then paste within Outlook. Quality is poor. 2) Quality is better with Matlab's print utility (png, tif) but figure aspect ratio is not preserved. 3) Aspect ratio is preserved with the program http://www.mathworks.com/matlabcentral/fileexchange/727-exportfig/content/exportfig.m but inserting the figure into Outlook is cumbersome (Insert > Picture then hunt for figure file).

The ideal solution would produce a high-quality figure with correct aspect ratio by (a) opening a new Outlook message with the figure embedded in the message body, or (b) better copying to the clipboard. Suggestions?

[Can't figure out how to insert a line break, sorry]

2 comments

Daniel on 23 Nov 2011

What do you mean by the quality is poor with the Copy Figure option? What type of figure are you dealing with? What is the figure renderer?

Kathleen on 24 Nov 2011

The figure looks very pixelated once it is copied to Outlook. This is true for lines and text, and for all options that are in Copy > Figure (bitmap, optimized for PowerPoint, etc).

Products

    1 answer

    Oliver Woodford answered on 23 Nov 2011
    Accepted answer

    This code will copy a figure to the clipboard as an image:

    imclipboard('copy', export_fig());
    

    Both imclipboard and export_fig can be found on the file exchange.

    5 comments

    K E on 28 Nov 2011

    Thanks for the suggestion, which has eliminated a Matlab irritant for me. I get nice non-blurry results when copying into Outlook from the following,
    imclipboard('copy', export_fig('r', 190, 'format', 'png'));
    This should be built into Matlab's Figure > Copy.

    Oliver Woodford on 28 Nov 2011

    The options you are using with export_fig are not valid, and do nothing; the result will be identical to the command in my answer. If you want a higher resolution output, use:
    imclipboard('copy', export_fig('-r190'));

    K E on 29 Nov 2011

    You are right, sorry, I was mixing up export_fig and exportfig.

    owr on 29 Nov 2011

    This is great, you just made my life easier as well. I put this function call in a toolbar shortcut preceded by "set(gcf,'Color',[1 1 1])". A white figure background looks nice in Outlook.

    Thank you!

    K E on 30 Nov 2011

    Here is an explanation of how to make a toolbar shortcut, since I didn't realize it was possible before the prior comment,
    http://blogs.mathworks.com/desktop/2007/03/29/shortcuts-for-commonly-used-code/

    Contact us at files@mathworks.com