Matlab interpreter window with the COM Automation interface.
The executable file MatlabInterfacingEngine.exe may be used as an
Automation server or a standalone application running the Matlab
interpreter in MFC CEditView-based window.
The Automation interface includes the following methods:
-
BSTR getLastOutput();
Returns Matlab output from the last Matlab statement up to10000 characters.
- short evaluateString(BSTR statement);
Executes the Matlab statement. Returns 0 on success.
- short putScalar(BSTR name, VARIANT value);
The VARIANT value is expected to hold a numeric value.
The function puts it into the Matlab Engine's memory attached to a Matlab language identifier supplied by the
BSTR name. Returns 0 on success.
- short putArray(BSTR name, VARIANT value);
The VARIANT value is expected to hold a SAFEARRAY of doubles: vt=VT_ARRAY|VT_BYREF|VT_R8.
- short putMatrix(BSTR name, VARIANT value);
- short getScalar(BSTR name, VARIANT* putHere);
Gets a scalar associated with the Matlab identifier supplied by the BSTR name.
- short getArray(BSTR name, VARIANT* putHere, short* dim);
- short getMatrix(BSTR name, VARIANT* putHere, short* rows, short* cols);
For more information on the interface see the example below.
Implementation.
Package.
Demonstration. (Running Matlab in Excel spread sheet)
This topic elaborates on
-
how to implement Document-View interaction;
-
how to send-catch user generated messages;
-
how to capture double control key messages;
-
how to manipulate VARIANT and SAFEARRAY in C++ code;
-
how to send a dynamic array through Automation call;
-
how to use CEdit and CEditView;
-
how to manipulate String in VB code;
-
how to use Matlab mx and Engine API functions;
-
how to attach a COM automation interface to an MFC class;
-
how to call a COM object from an Excel spreadsheet;
-
how to call a COM object from an MFC application;