assign a value to a Maple variable in external code - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : OpenMaple : VB Application Programming Interface : Assignment and Selection Functions : OpenMaple/VB/MapleAssign

MapleAssign - assign a value to a Maple variable in external code

MapleAssignIndexed - assign to an indexable object element in external code

Calling Sequence

MapleAssign(kv, lhs, rhs)

MapleAssignIndexed(kv, lhs, n, ind, rhs)

Parameters

kv

-

kernel handle returned by StartMaple

lhs

-

assignable Maple object

rhs

-

Maple object

n

-

length of ind

ind

-

index array

Description

• 

These functions are part of the OpenMaple interface to Microsoft Visual Basic.

• 

The MapleAssign function attempts to assign lhs := rhs.

• 

The MapleAssignIndexed function attempts to assign lhs[ind] := rhs. The index, ind is an array of 32-bit integers. To reference lhs[1,2], set ind[0] = 1, and ind[1] = 2.

Examples

Sub TestMapleAssign(ByVal kv As Long)

    Dim a, b, r, val As Long

    Dim index(1) As Long

    ' assign to Maple variables a and b

    a = ToMapleName(kv, "a", True)

    MapleAssign kv, a, ToMapleFloat(kv, 3.14)

    b = ToMapleName(kv, "b", True)

    MapleAssign kv, b, ToMapleFloat(kv, 2.71)

    ' compute a*b

    val = EvalMapleStatement(kv, "a*b;")

    'save the result in a table called my_results

    r = ToMapleName(kv, "my_results", True)

    index(0) = 1

    index(1) = 1

    MapleAssignIndexed kv, r, 2, index(0), val

    MapleALGEB_Printf1 kv, "%a", val

    MapleALGEB_Printf1 kv, "%a", MapleSelectIndexed(kv, r, 2, index(0))

    EvalMapleStatement kv, "eval(my_results);"

End Sub

See Also

OpenMaple, OpenMaple/VB/API, OpenMaple/VB/Examples


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam