MLGetFigure

Import current MATLAB figure into Microsoft Excel spreadsheet

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 spreadsheet 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 spreadsheet 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

expand all

Import a MATLAB Figure into an Excel Worksheet

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.

More About

expand all

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™ EX 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.

See Also

|

Was this topic helpful?