MATLAB: How to open MATLAB figures in Powerpoint and be able to edit them


If I copy->paste or export MATLAB 7.5 (R2007b) created figures as images to Microsoft Powerpoint slides, I am unable to carry out MATLAB -like operations, for example, rescaling axes.

Best Answer

  • There is no direct way to modify MATLAB figures in Powerpoint since Powerpoint cannot import MATLAB figure files as images.
    However, a possible workaround is to use Powerpoint's Control Toolbox to launch a new MATLAB figure by starting MATLAB as a COM server. This new figure can be positioned to overlap the existing figure on the Powerpoint slide and be edited using MATLAB 'Plot Tools' for demonstrations. Following is a description of one of the ways to do this. This example was tested in Microsoft Powerpoint 2003:
    1.Enable the Control Toolbox : Open a Powerpoint slide and click on View->Toolbars->Control Toolbox.
    2. Select an ActiveX control to insert in the slide. For this example, an image. This should create a control area on the slide. Now set the image area to display a saved image.
    3. Write a VBA macro: Double click on the control area. This should open a VBA box to write a macro. For example, the following macro opens a MATLAB figure at the desired place on a powerpoint slide:
    Private Sub Image1_Click()
    Set Matlab = CreateObject("Matlab.Application")
    R = Matlab.Execute("figure ('position', [540 420 880 600])")
    Result = Matlab.Execute("surf(peaks)")
    %%to make MATLAB session visible
    Matlab.Visible = 1
    End Sub
    Note that MATLAB needs to be registered as a COM Automation server prior to using this example. For registering MATLAB as a COM server, consult the product documentation.