Main Content

MLClose

Description

example

= MLClose() ends the MATLAB® process, deletes all variables from the MATLAB workspace, and tells the Microsoft® Excel® software that the MATLAB software is no longer running. Use this syntax when working directly in a worksheet.

MLClose ends the MATLAB process, deletes all variables from the MATLAB workspace, and tells the Microsoft Excel software that the MATLAB software is no longer running. Use this syntax in a VBA macro.

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

Examples

collapse all

End the MATLAB session from a worksheet:

MLClose()

Output Arguments

collapse all

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

Tips

  • If you use MLClose when no MATLAB process is running, nothing happens.

  • 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 before R2006a