从C#运行matlab并将参数提供给matlab

mhn*_*mak 4 c# matlab

我有一个C#程序,它应该调用Matlab来运行一个m文件,因此Matlab程序从文本文件中读取参数,这些参数可能因情况而异.

我想要这样的:

Execute(Matlab.exe,"matlabprog.m","input_parameters_file.txt");
Run Code Online (Sandbox Code Playgroud)

如果我知道这个Matlab实例何时终止运行,这对我有好处.

jer*_*enh 8

看看Process.Start方法:

 var process = Process.Start("matlab.exe", 
                             "matlabprog.m input_parameters_file.txt");
 process.WaitForExit();
Run Code Online (Sandbox Code Playgroud)


And*_*ein 5

考虑使用Matlab引擎或使用Matlab Builder NA编译.NET程序集.另请查看这篇文章,其中我解释了一些可能性.