外部インタフェース/API | ![]() ![]() |
例: Visual BasicとMATLAB DDE Serverを使って
この例は、2つのテキスト編集コントロールTextInputとTextOutputをもつVisual Basicの形式です。このコードは、TextInput_KeyPress
メソッドです。
Sub TextInput_KeyPress(KeyAscii As Integer) rem If the user presses the return key rem in the TextInput control. If KeyAscii = vbKeyReturn then rem Initiate the conversation between the TextInput rem control and MATLAB under the Engine topic. rem Set the item to EngEvalString. TextInput.LinkMode = vbLinkNone TextInput.LinkTopic = "MATLAB|Engine" TextInput.LinkItem = "EngEvalString" TextInput.LinkMode = vbLinkManual rem Get the current string in the TextInput control. rem This text is the command string to send to MATLAB. szCommand = TextInput.Text rem Perform DDE Execute with the command string. TextInput.LinkExecute szCommand TextInput.LinkMode = vbLinkNone rem Initiate the conversation between the TextOutput rem control and MATLAB under the Engine topic. rem Set the item to EngStringResult. TextOutput.LinkMode = vbLinkNone TextOutput.LinkTopic = "MATLAB|Engine" TextOutput.LinkItem = "EngStringResult" TextOutput.LinkMode = vbLinkManual rem Request the string result of the previous EngEvalString rem command. The string ends up in the text field of the rem control TextOutput.text. TextOutput.LinkRequest TextOutput.LinkMode = vbLinkNone End If End Sub
![]() | DDE名の階層 | MATLABをクライアントとして使う | ![]() |