我想在C#中执行matlab函数。 我写这个matlab函数。
function []= f(input)
save('D:\test.txt','input','-ASCII');
end
然后通过“deploytool”创建exe文件,形成这个matlab代码。
我尝试在C#中运行exe文件。
private void button1_Click(object sender, EventArgs e)
{
string fileName = @"D:\test.exe"; //address of exe file
Process p = new Process();
p.StartInfo.FileName = fileName;
int[][] d = new int[2][];
for(int i = 0 ; i< d.Length;i++)
{
d[i] = new int[3];
for(int j = 0 ; j < d[0].Length;j++)
d[i][j] = i + j;
}
p.StartInfo.Arguments = d.ToString();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.Start();
p.WaitForExit();
}
但保存的文本文件包含:
8.3000000e+01 1.2100000e+02 1.1500000e+02 1.1600000e+02 1.0100000e+02 1.0900000e+02 4.6000000e+01 7.3000000e+01 1.1000000e+02 1.1600000e+02 5.1000000e+01 5.0000000e+01 9.1000000e+01 9.3000000e+01 9.1000000e+01 9.3000000e+01
请帮帮我。