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.

Execute

Execute MATLAB command in Automation server

Synopsis

IDL Method Signature

BSTR Execute([in] BSTR command)

Microsoft Visual Basic Client

Execute(command As String) As String

MATLAB Client

result = Execute(h,'command')

Description

The Execute function executes the MATLAB® statement specified by command in the MATLAB Automation server attached to handle h.

The server returns output from the command in result. result also contains any MATLAB warning or error messages.

If you terminate the MATLAB command with a semicolon and there are no warnings or error messages, result might be empty.

COM functions are available on Microsoft® Windows® systems only.

Visual Basic .NET Examples

Create a 6-by-6 matrix in the MATLAB server, remove rows 4–6, and return the results to the client.

Dim Matlab As Object
Dim server_version As String
Matlab = CreateObject("matlab.application")
MatLab.PutWorkspaceData("A","base",rand(6))
Matlab.Execute("A(4:6,:) = [];")
Matlab.GetWorkspaceData("A","base",B)

More About

collapse all

Tips

If you want to display output from Execute in the client window, specify an output variable, result.

If there is an error, the Execute function returns the MATLAB error message with the characters ??? prepended to the text.

Introduced before R2006a

Was this topic helpful?