声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1120|回复: 1

[混合编程] ASP.NET(C#)调用Matlab中一大难题

[复制链接]
发表于 2007-4-10 14:34 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
小弟现在正做一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=[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

源错误: 


行 60:     string strMatLab;  
行 61:     MLApp.MLAppClass MatLab = new MLApp.MLAppClass();
行 62:     MatLab.MinimizeCommandWindow();
行 63:     strMatLab = "sale=[100 400 150 250 500];pie3(sale,[0 0 1 0 0],{'A','B','C','D','E'})";
行 64:     MatLab.Execute(strMatLab);
 

源文件: f:\web\40401\webform1.aspx.cs  行: 62 

堆栈跟踪: 


[COMException (0x80020009): Can't locate command window]
  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()
请各位大狭帮忙看看。
小弟在此先谢谢大家了。
回复
分享到:

使用道具 举报

 楼主| 发表于 2007-4-10 18:32 | 显示全部楼层
:victory:
顶啊!!!!!!!!!!!!
:victory:
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-5-23 22:44 , Processed in 0.060024 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表