Contents Previous Next Subchapters

Evaluating an O-Matrix Expression
Syntax status = OMServer.Eval(command)
See Also comopen

Passes the argument command to O-Matrix for execution. The argument command must be a string that represents a valid O-Matrix expression. The returned value status is an integer OM Server Status code. This value will equal 1 if this function succeeded.

Start Visual Basic and create a new project. Bind to the O-Matrix server type library by selecting OMatrixServer Type Library from the 'Project | References' dialog. In the Project Properties dialog select Sub Main from the Startup Object field. Add a new module to the project and paste the following code into the new module.

Public OM As New OMServer

Sub Main()
    Dim status As Integer
    status = OM.Open
    If status <> 1 Then
        MsgBox ("Unable to establish connection to O-Matrix")
    End If
    status = OM.Eval("s =seq(3)^2")
    If status = 1 Then
        status = OM.Eval("gplot(s)")
    End If
    If status <> 1 Then
        MsgBox ("Unable to execute O-Matrix command")
    End If
End Sub

Run the project and O-Matrix will display a line plot of the exponential sequence s