小弟现在正做一C#.NET调用Matlab课题,具体代码如下
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using MLApp;
using System.Reflection;
private void Button1_Click(o b j e c t sender, System.EventArgs e)
{
string strMatLab;
MLApp.MLAppClass MatLab = new MLApp.MLAppClass();
MatLab.MinimizeCommandWindow();
strMatLab = "sale=[100 400 150 250 500];pie3(sale,[0 0 1 0 0],{'A','B','C','D','E'})";
MatLab.Execute(strMatLab);
MatLab.Execute(@"print( gcf, '-djpeg', 'c:\Test1')");
MatLab.Quit();
MatLab = null;
Image1.ImageUrl ="c:\\Test1.jpg";
}
可运行后总出现如下错误
Can't locate command window
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.Runtime.InteropServices.COMException: Can't locate command window
源错误: