Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'mathlink - how to assign a varible to a symbol' topicStudent Support Forum > General > Archives > "mathlink - how to assign a varible to a symbol"

Help | Reply To Topic
Author Comment/Response
PatR1
04/24/07 01:35am


Please help, I am interfacing my c++ program with mathlink.
And I cannot figure out how to assign an external variable to a symbol.

Int p, x=23;

MLPutFunction(link, "EvaluatePacket", 1);
MLPutFunction(link, "ToString", 1); /
MLPutFunction(link, "ToExpression", 1);
MLPutFunction(link, "Plus",2);
MLPutInteger(link,x)
   MLPutInteger(link,p)

The above example works, it adds 2 integer variables together.
The problem is I dont know how to assign a integer variable to a symbol.
This is what I want to do:

   MLPutFunction(link, "EvaluatePacket", 1);
MLPutFunction(link, "ToString", 1); /
MLPutFunction(link, "ToExpression", 1);
MLPutString(link,x+p);
MLPutSymbol(link,X) // how to assign variable x to symbol X????
   MLPutSymbol(link,p)


Thanks so much
Pat   


URL: ,
Help | Reply To Topic