Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

MLGetFigure

Import current MATLAB figure into Microsoft Excel worksheet

Syntax

= MLGetFigure(width,height)
MLGetFigure width, height
out = MLGetFigure(width,height)

Description

= MLGetFigure(width,height) import the current MATLAB® figure into an Excel® worksheet, where the top-left corner of the figure is the current worksheet cell. Use this syntax when working directly in a worksheet.

MLGetFigure width, height import the current MATLAB figure into an Excel worksheet, where the top-left corner of the figure is the current worksheet cell. Use this syntax in a VBA macro.

out = MLGetFigure(width,height) lets you catch errors when executing MLGetFigure in a VBA macro. If MLGetFigure fails, then out is a string containing error code. Otherwise, out is 0.

Input Arguments

width

Width (in normalized units) of the MATLAB figure when imported into an Excel worksheet.

height

Height (in normalized units) of the MATLAB figure when imported into an Excel worksheet.

Output Arguments

out

0 if the command succeeded. Otherwise, a string containing error code.

Examples

collapse all

Import the current MATLAB figure into an Excel worksheet. Specify the width and the height of the figure to be half those of the original figure:

MLGetFigure(.5,.5)

Note that if you use Microsoft® Excel 2007 or 2010, the width and the height of the imported figure will be a quarter of those of the original figure.

Tips

  • If you use Microsoft Excel 2007 or 2010, MLGetFigure scales the imported figure by the product of width and height along both dimensions.

  • If worksheet calculation mode is automatic, MLGetFigure executes when you enter the formula in a cell. If worksheet calculation mode is manual, enter the MLGetFigure function in a cell, then press F9 to execute it. Remember that pressing F9 in this situation can also execute other worksheet functions again and generate unpredictable results.

  • If you use MLGetFigure in a macro subroutine, enter MatlabRequest on the line after the MLGetFigure. MatlabRequest initializes internal Spreadsheet Link™ variables and enables MLGetFigure to function in a subroutine. Do not include MatlabRequest in a macro function unless the function is called from a subroutine.

Introduced in R2006b

Was this topic helpful?