Этот пример вызывает функции MATLAB® с клиентского приложения Microsoft® Visual Basic® на COM-интерфейс. Пример строит график в новом окне MATLAB и выполняет простое вычисление.
Dim MatLab As Object
Dim Result As String
Dim MReal(1, 3) As Double
Dim MImag(1, 3) As Double
MatLab = CreateObject("Matlab.Application")
'Call MATLAB function from VB
Result = MatLab.Execute("surf(peaks)")
'Execute simple computation
Result = MatLab.Execute("a = [1 2 3 4; 5 6 7 8]")
Result = MatLab.Execute("b = a + a ")
'Bring matrix b into VB program
MatLab.GetFullMatrix("b", "base", MReal, MImag)