100分求一个用C#写的访问---Matlab---的控制台程序,编译通过马上给分结贴

解决方案 »

  1.   

    using System;
    using System.Reflection;namespace ConsoleApplication4
    {
         class Class1
         {
             [STAThread]
             static void Main(string[] args)
             {
                 //Get the type info             Type matlabtype;
                 matlabtype =   Type.GetTypeFromProgID("matlab.application");             //Create an instance of MATLAB             object matlab;
                 matlab = Activator.CreateInstance(matlabtype);             //Prepare input as an object             object[] arrayInput = new Object[] {"surf(peaks)"};             //Call MATLAB method             matlabtype.InvokeMember("Execute",BindingFlags.InvokeMethod,null,matlab,arrayInput);
             }
         }
    }