ASP.NET(C#)调用Matlab中一大难题
小弟现在正做一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(object sender, System.EventArgs e)
{
string strMatLab;
MLApp.MLAppClass MatLab = new MLApp.MLAppClass();
MatLab.MinimizeCommandWindow();
strMatLab = "sale=;pie3(sale,,{'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
源错误:
行 60: string strMatLab;
行 61: MLApp.MLAppClass MatLab = new MLApp.MLAppClass();
行 62: MatLab.MinimizeCommandWindow();
行 63: strMatLab = "sale=;pie3(sale,,{'A','B','C','D','E'})";
行 64: MatLab.Execute(strMatLab);
源文件: f:\web\40401\webform1.aspx.cs 行: 62
堆栈跟踪:
System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData) +457
MLApp.MLAppClass.MinimizeCommandWindow() +0
_40401.WebForm1.Button1_Click(Object sender, EventArgs e) in f:\web\40401\webform1.aspx.cs:62
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()
请各位大狭帮忙看看。
小弟在此先谢谢大家了。 :victory:
顶啊!!!!!!!!!!!!
:victory:
页:
[1]