GetCharArray和PutCharArray函数实现从MATLAB服务器读取字符串值,以及写字符串值到MATLAB服务器。
在MATLAB服务器基本工作空间中将一个字符串写入变量str,然后将它读回到客户程序。
VB.NET中使用下面的语句行执行MATLAB命令。
code.vb.net
Dim objM As MLApp.MLApp
Dim strT As String = ""
objM = New MLApp.MLApp
objM.PutCharArray("str", "base", "Hello MATLAB")
strT = objM.GetCharArray("str", "base")
VC#.NET中使用下面的语句行执行MATLAB命令。
code.vc#.net
MLApp.MLApp objM;
string strT = "";
objM = new MLApp.MLApp();
objM.PutCharArray("str", "base", "Hello MATLAB");
strT = objM.GetCharArray("str", "base");