迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
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");
|
请发表评论