This example calls a user-defined MATLAB® function named solve_bvp
from
a Microsoft®
Visual Basic® client application through a COM interface.
It also plots a graph in a new MATLAB window and performs a simple
computation:
Dim MatLab As Object Dim Result As String Dim MReal(1, 3) As Double Dim MImag(1, 3) As Double MatLab = CreateObject("Matlab.Application") 'Calling MATLAB function from VB 'Assuming solve_bvp exists at specified location Result = MatLab.Execute("cd d:\matlab\work\bvp") Result = MatLab.Execute("solve_bvp") 'Executing other MATLAB commands Result = MatLab.Execute("surf(peaks)") 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)