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.

MLShowMatlabErrors

Return standard Spreadsheet Link errors or full MATLAB errors

Syntax

= MLShowMatlabErrors(flag)
MLShowMatlabErrors flag

Description

example

= MLShowMatlabErrors(flag) sets the error message type when executing MATLAB® commands using MLEvalString in Microsoft® Excel®. An error displays when MLEvalString fails. You can display two different types of error messages. At any point, you can switch between displaying Spreadsheet Link™ and MATLAB errors. Without this function, worksheet cells display only Excel error messages. Use this syntax when working in a worksheet cell.

example

MLShowMatlabErrors flag works in a VBA macro.

Examples

collapse all

This Spreadsheet Link code assumes MLEvalString returns MATLAB errors upon failure.

Enter this text in any worksheet cell to display MLEvalString failures as Spreadsheet Link errors.

=MLShowMatlabErrors("no")

Enter this invalid text in any worksheet cell.

=MLEvalString("sum(2+b);")

This Spreadsheet Link error appears in the calling cell.

#COMMAND!

This VBA code assumes MLEvalString returns Spreadsheet Link errors upon failure.

Enter this text at the beginning of a VBA macro to display MLEvalString failures as MATLAB errors.

MLShowMatlabErrors "yes"

Enter this invalid text in the VBA macro.

out = MLEvalString("sum(2+b);")
MsgBox (out)

When running this macro, this MATLAB error appears in a dialog box: ??? Undefined function or variable 'b'. For details on running macros, see Excel Help.

Input Arguments

collapse all

Error message indicator, specified as "no" or "yes" to determine the type of error message displayed when MLEvalString fails. To display the standard Spreadsheet Link errors, specify "no". To display the full MATLAB errors, specify "yes".

Introduced in R2006b

Was this topic helpful?