MLApp.MLApp matlab = null;
            Type matlabAppType = System.Type.GetTypeFromProgID("Matlab.Application");
            matlab = System.Activator.CreateInstance(matlabAppType) as MLApp.MLApp;
            string path_project = Directory.GetCurrentDirectory();
            Console.WriteLine(path_project);//matlab程序放在这个目录下
            string path_matlab = "cd('" + path_project + "')";
            matlab.Execute(path_matlab);
            string cmd = @"[count1,count2,count3,count5]=netGetResult()";//matlab命令,前面为返回参数,后面为执行方法
            matlab.Execute("clear all");
            matlab.Execute(cmd);
            var result1 = matlab.GetVariable("count1", "base");
            var result2 = matlab.GetVariable("count2", "base");
            var result3 = matlab.GetVariable("count3", "base");
            var result5 = matlab.GetVariable("count5", "base");

 

相关文章:

  • 2022-12-23
  • 2021-10-26
  • 2022-12-23
  • 2022-12-23
  • 2022-02-14
  • 2022-01-04
  • 2021-06-18
  • 2021-08-24
猜你喜欢
  • 2021-06-04
  • 2021-07-22
  • 2021-10-22
  • 2021-07-18
  • 2021-06-24
  • 2022-12-23
  • 2021-11-19
相关资源
相似解决方案