Main Content

MLProgramId

Specify MATLAB version

Description

example

= MLProgramId(version) specifies the MATLAB® version to open when Spreadsheet Link™ starts in Microsoft® Excel®. Enter this syntax when working in a worksheet cell.

example

MLProgramId version specifies the MATLAB version. Enter this syntax when working in a VBA macro.

Examples

collapse all

To open MATLAB (R2016a) in Microsoft Excel, enter this text in any worksheet cell:

=MLProgramId("9.0")

The worksheet cell displays 0 when MLProgramId runs.

To check that the preference is set, open the Preferences dialog box. The MATLAB program id box contains 9.0. For details about the Preferences dialog box, see Set Spreadsheet Link Preferences.

Start MATLAB.

For troubleshooting, see Startup Errors.

To open MATLAB (R2016a) in Microsoft Excel, enter this text at the beginning of the VBA macro:

MLProgramId "9.0"

Run the macro by clicking Run Macro button. For details about running macros, see Excel Help.

To check that the preference is set, open the Preferences dialog box. The MATLAB program id box contains 9.0. For details about the Preferences dialog box, see Set Spreadsheet Link Preferences.

Start MATLAB.

For troubleshooting, see Startup Errors.

Input Arguments

collapse all

MATLAB version, specified as a string to indicate which MATLAB version to open when multiple versions are installed on the computer.

The Windows® registry defines the MATLAB version number under ...\Mathworks\MATLAB. For example, MATLAB R2016a corresponds to version 9.0 in the registry.

Example: "9.0"

Tips

  • To work with VBA code in Excel with Spreadsheet Link, you must enable Spreadsheet Link as a reference in the Microsoft Visual Basic® Editor. For details, see Installation.

Version History

Introduced in R2016b