Printing and Exporting Figures with MATLAB    

Example - Exporting an EMF to the Clipboard

This example uses the clipboard to export a figure to an EMF file. The settings made to the figure before it is copied to the clipboard include applying a template, increasing the font size, and setting the size for the exported figure. The instructions refer to using the graphical user interface, then show how to perform the same operations using MATLAB commands.

  1. Create a figure containing text. You can use the following code.
  2. Select Copy Options from the File menu. This invokes the Preferences dialog box. In the left pane, select Figure Copy Template.
  3. In the Figure Copy Template Preferences pane on the right, click the PowerPoint button.
  1. The MATLAB-suggested settings for PowerPoint are added to the template. Some of the fields in the panel update to show the settings. For example, the PowerPoint template increases the font size.

    These are recommended settings. You can change them to anything you want.

  1. In the Lines group box, change the Custom width to 4 points.
  2. In the Uicontrols and axes group box select Lock axes and tick labels to prevent MATLAB from possibly rescaling ticks and limits when you export.
  3. Click Apply. The changes appear in the figure window. Note how the title and axes labels have been enlarged and made bold and the contour lines are much thicker.
  1. If you don't like the way your figure looks with the new settings, restore it to its original settings by clicking the Restore button.

  1. Deselect Match figure screen size so that you can use your own figure size settings.
  2. In the left pane of the Preferences dialog box, expand the Figure Copy Template topic. Select Copy Options.
  1. In the Copy Options pane, select Metafile so that MATLAB will export the figure to the clipboard as a metafile.

  1. Click OK. Note how the figure's background becomes hatched. This indicates that the background will be transparent in the exported file.
  2. Select Page Setup from the File menu.
  3. In the Size and Position tab, set Width to 10 and Height to 7.5. Make sure that Units are set to Inches.
  4. Click OK.
  5. Select Copy Figure from the Edit menu. Your figure is now exported to the clipboard and can be pasted into another Windows application. If you are using PowerPoint, select Paste from the Edit menu and position your figure on the slide.

To do the same tasks using MATLAB commands, use

Figure 4-9: Figure with Transparent Background Copied to a Slide


 Setting Copy Preferences Exporting Using MATLAB Commands