|
SOLUTIONS
|
MATHEMATICA MATHLINK C 関数
MLEvaluateString()
int MLEvaluateString(MLINK link, char *string)
Mathematica に文字列を送信し評価させる.評価の結果として返されるパケットはすべて放棄される.
詳細詳細
- MLEvaluateString()のコードはMathLink ライブラリに含まれていないが,MathLink テンプレートファイルを処理する際にmccあるいはmprepで自動的に生成される.
は,リンクの向こう側にあるMathematica セッションの中で
を出力させる.- MLEvaluateString()はmprep MathLink templateプログラム内に限って使用可能である.
- MLEvaluateString()は不成功の場合に0を返し,成功の場合には0以外の値を返す.
- MLEvaluateString()はMathLink ヘッダファイルmathlink.hの中で宣言される.
例題例題すべて開くすべて閉じる
例 (1)例 (1)
:Begin:
:Function: f
:Pattern: KernelTime[]
:Arguments: {}
:ArgumentTypes: Manual
:ReturnType: Manual
:End:
#include "mathlink.h"
/* read the Kernel's response from evaluating the expression
{Date[],$TimeZone} */
void f(void)
{
/* Pretend we are not in our local timezone. */
if(! MLEvaluateString(stdlink, "$TimeZone = 9;"))
{ /* unable to send $TimeZone = 9; to stdlink */ }
if(! MLEvaluate(stdlink, "{Date[],$TimeZone}"))
{ /* unable to send the expression to stdlink */ }
/* get the Kernel's response */
switch(MLGetType(stdlink))
{
/* ... */
}
/* ... */
}
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »
