求助,我的c#怎么数据库引擎找不到对象matlab的引擎库

温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!&&|&&
we are 5. Mathematics, Computation, Programming, Engineering, and Making fun of life.
LOFTER精选
网易考拉推荐
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
&MATLABMATLAB(.exe)(.dll)FortranCC++MATLAB Builder EXMATLABExcelMATLAB Builder JAMATLABJavaMATLABMATLAB Builder NEMATLAB.NET.NETC#VB.NETJ#C++.NETF#ASP.NET
2.外部语言的选取
MATLAB.NET.NET
&&&&&& .NET
&&&&&& .NET is a "revolutionary new platform built on open Internet protocols and standards with tools and services that meld computing and communications in new ways".NET
Web Services
Internet Steve Ballmer.NETInternet
&&&&&& .NET.NET Framework.NET.NET FrameworkCLRCLR(managed code).NET.NET FrameworkVBVBjavaJVMJava.NET Framework&&&&&&& Visual Studio.NETCLS.NETCLRMATLAB Builder NEMBasic Class Library
&&&&&& NET Framework.NETC#.NETVisual Studio.NETVisual Studio2010
3.如何实现混合编程
&&&&&& .NETMATLABMATLAB.NETMATLABNATLABC#MATLAB
3.1MATLAB.NET
MATLAB.NETMATLABMATLABMATLAB.NET
1..NET2..NET.NETMAT
.NETMATLABMATLABMATLAB.NET Framework
&& dt=System.DateTime()
& System.DateTime
& Package: System
& Properties:
&&&&&&&&&& Date: [1x1 System.DateTime]
&&&&&&&&&&& Day: 11
&&&& &DayOfWeek: [1x1 System.DayOfWeek]
&&&&& DayOfYear: 131
&&&&&&&&&& Hour: 0
&&&&&&&&&& Kind: [1x1 System.DateTimeKind]
&&& Millisecond: 0
&&&&&&&& Minute: 0
&&&&&&&&& Month: 5
&&&&&&&&&&& Now: [1x1 System.DateTime]
&&&&&&&& UtcNow: [1x1 System.DateTime]
&& &&&&&&Second: 0
&&&&&&&&& Ticks: 000000
&&&&& TimeOfDay: [1x1 System.TimeSpan]
&&&&&&&&& Today: [1x1 System.DateTime]
&&&&&&&&&& Year: 2011
&&&&&& MinValue: [1x1 System.DateTime]
&&&&&& MaxValue: [1x1 System.DateTime]
& Methods, Superclasses
&&&&&& MATLABSystem.dllmscorlib.dll.NETDateTimedtDateTime(year,month,day)MATLAB
&& dt.Year
&& &&&&&2011
&&&&&& .NETMATLAB
&& properties System.DateTime
&& methods System.DateTime
&&&&&& .NETVisual Studio.NET
&&&&&& VSClass1.cs
using System.Collections.G
using System.T
using System.Windows.F
namespace ToMATLAB
&&& public class XDClass
&&&&&&& //这是一个不带返回值的方法
&&&&&&& public void Message()
&&&&&&&&&&& MessageBox.Show("Here is Dot Net~");
&&&&&&& //这是一个属性
&&&&&&& public string Help
&&&&&&&&&&& get
&&&&&&&&&&& {
&&&&&&&&&&&&&&& return "I am a Property of Class XDClass";
&&&&&&&&&&& }
&&&&&&& //这是一个带返回值的方法,利用海伦公式计算三角形面积
&&&&&&& public double TriangleArea(double a,double b,double c)
&&&&&&&&&&& double max =
&&&&&&&&&&& if (max & b) max =
&&&&&&&&&&& if (max & c) max =
&&&&&&&&&&& if (2 * max &= a + b + c)
&&&&&&&&&&&&&&& return -1;//不构成三角形
&&&&&&&&&&& else
&&&&&&&& &&&{
&&&&&&&&&&&&&&& double p = (a + b + c) / 2;
&&&&&&&&&&&&&&& return Math.Sqrt(p * (p - a) * (p - b) * (p - c));
&&&&&&&&&&& }
&&&&&& F6ToMATLAB.dllMATLAB.NETMATLABCommand Window
&& asmInfo = NET.addAssembly('C:\Users\Castor\Desktop\ToMATLAB.dll')
& NET.Assembly handle
& Package: NET
Properties for class NET.Assembly:
&&& AssemblyHandle
&&& Classes
&&& Structures
&&& GenericTypes
&&& Interfaces
&&& Delegates
NET.addAssembly.NETPropertiesmethods
&& properties ToMATLAB.XDClass
Properties for class ToMATLAB.XDClass:
&& methods ToMATLAB.XDClass
Methods for class ToMATLAB.XDClass:
Equals Message&&&&&& XDClass&&&&&& eq&&&&&&& &&&&ge&&&&&&&&&&& le&&&&&&&&&&& notify
GetHashCode&& ToString&&&&& addlistener&& findobj&&&&&& gt&&&&&&&&&&& lt&&&&&&&&&&&
GetType&&&&&& TriangleArea& delete&&&&&&& findprop&&&&& isvalid&&&&&& ne
&&&&&& MATLAB
&& xd=ToMATLAB.XDClass()
& ToMATLAB.XDClass handle
& Package: ToMATLAB
& Properties:
&&& Help: [1x1 System.String]
& Methods, Events, Superclasses
&& xd.Help
I am a Property of Class XDClass
&& xd.Message
&& xd.Message
xd.Message
&& xd.TriangleArea(3,4,5)
&& xd.TriangleArea(3,4,1)
Message.NETMessageBox.ShowCommand Windowxd-1
4.外部程序调用MATLAB函数
&MCRMATLAB Compiler RuntimeMATLABMathWorks
The MATLAB Compiler Runtime (MCR) is an execution engine made up of the same shared libraries MATLAB uses to enable the execution of MATLAB files on systems without an installed version of MATLAB.
MCRMATLABMATLABMATLAB.NET Framework.NETMCRMATLAB.NET.NET FrameworkMCRMATLABMATLABmcrmcrinstaller
The WIN32 MCR Installer, version 7.14, is:
&&& D:\MATLAB\toolbox\compiler\deploy\win32\MCRInstaller.exe
MCR installers for other platforms are located in:
&&& D:\MATLAB\toolbox\compiler\deploy\&ARCH&
& &ARCH& is the value of COMPUTER('arch') on the target machine.
Full list of available MCR installers:
D:\MATLAB\toolbox\compiler\deploy\win32\MCRInstaller.exe
For more information, read your local MCR Installer help.
Or see the online documentation at The MathWorks' web site. (Page may load slowly.)
D:\MATLAB\toolbox\compiler\deploy\win32\MCRInstaller.exe
4.2 MWArray API
&MCRMWArray.dllAPIMCRMATLABMCRMCRinstallation_folder\toolbox\dotnetbuilder\bin\architecture\framework_version
MathWorks.MATLAB.NET.ArraysMathWorks.MATLAB.NET.UtilityArraysCLSCommon Language Specification MATLABUtilityMWArrayMATLABAPI4.3.
MATLAB.NET
4.3.1 MATLAB端的工作
MMATLABMMATLABSVDMATLABM
%函数1.矩阵的SVD分解
function [u,s,v]=XDSVD(A)
&&& [u,s,v]=svd(A);
%函数2.生成幻方矩阵
function m=XDMagic(n)
&&& m=magic(n);
XDSVD.mXDMagic.m.NETdeploytool
&& deploytool
.NET Assembly&&& & &&Deployment ToolFunctionsM&&XDMagicXDSVDFunctionsPackage&&&&&&& Add MCRMCRInstaller.exe1KB173MBMCR
&&&&&& distribCastor.dll.NET&4.3.2 .NET主程序编程
C#WindowsMWArray.dllCastor.dll
private void button1_Click(object sender, EventArgs e)
&&& Functions f = new Functions();
&&& MWNumericArray na =
&&& MWArray[] arr1 =
&&& MWArray[] arr2 =
&&& int i = Convert.ToInt16(textBox2.Text);
&&& arr1 = f.XDMagic(1, i);
&&&&&&& arr2 = f.XDSVD(3, arr1[0]);//返回三个数组
&&&&&&& MessageBox.Show(arr2[0].ToString(), "矩阵U:");
&&&&&&& MessageBox.Show(arr2[1].ToString(), "矩阵S:");
&&&&&&& MessageBox.Show(arr2[2].ToString(), "矩阵V:");
&&& catch (Exception exc)
&&&&&&& MessageBox.Show("出现异常,原因是:" + exc.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
private void button2_Click(object sender, EventArgs e)
&&& Functions f = new Functions();
&&& MWNumericArray na =
&&& MWArray[] ansArray =
&&& int i = Convert.ToInt16(textBox2.Text);
&&& ansArray=f.XDMagic(1,i);
&&& na = (MWNumericArray)ansArray[0];//只有一个数组返回
&&& MessageBox.Show(na.ToString());
幻方:&USV&&&&&&&& MATLABFunctions2~3
&&&&&& MATLAB.NETMATLAB
阅读(11548)|
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
历史上的今天
loftPermalink:'',
id:'fks_095068',
blogTitle:'【原创】简析MATLAB和.NET混合编程',
blogAbstract:'这个是我写的一篇关于MATLAB课程的作业,作业已提交。所以,ChenGuangda老师看到了请不要以为我的作业是从网上抄的,哈哈。0.背景
{elseif x.moveFrom=='iphone'}
{elseif x.moveFrom=='android'}
{elseif x.moveFrom=='mobile'}
${a.selfIntro|escape}{if great260}${suplement}{/if}
{list a as x}
推荐过这篇日志的人:
{list a as x}
{if !!b&&b.length>0}
他们还推荐了:
{list b as y}
转载记录:
{list d as x}
{list a as x}
{list a as x}
{list a as x}
{list a as x}
{if x_index>4}{break}{/if}
${fn2(x.publishTime,'yyyy-MM-dd HH:mm:ss')}
{list a as x}
{if !!(blogDetail.preBlogPermalink)}
{if !!(blogDetail.nextBlogPermalink)}
{list a as x}
{if defined('newslist')&&newslist.length>0}
{list newslist as x}
{if x_index>7}{break}{/if}
{list a as x}
{var first_option =}
{list x.voteDetailList as voteToOption}
{if voteToOption==1}
{if first_option==false},{/if}&&“${b[voteToOption_index]}”&&
{if (x.role!="-1") },“我是${c[x.role]}”&&{/if}
&&&&&&&&${fn1(x.voteTime)}
{if x.userName==''}{/if}
网易公司版权所有&&
{list x.l as y}
{if defined('wl')}
{list wl as x}{/list}C#调用matlab时遇到了个小问题【c#吧】_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:117,595贴子:
C#调用matlab时遇到了个小问题收藏
matlab部分的m文件是这样的:function faladi()%法拉第旋转角%{\beta}=V*B*d=O%{\beta}是旋转角弧%V为物质的韦尔代常数%B为磁场强度朝着光波传播方向的分量%d为光波与磁场相互作用的长度V=input('请输入韦尔代常数V= ');B=input('请输入磁强分量B= ');d=input('请输入长度d= ');O=V*B*d;disp(['旋转角弧=',num2str(O),'rad.']);J=O.*180/(pi);disp(['旋转角度=',num2str(J),'°.']);alpha=0:pi/50:2*
%角度[0,2*pi] R=2;
%半径 k=cos(J)/sin(J);x=R*cos(alpha); y=R*sin(alpha); plot(x,y,'-') axis equalhold onrefline(k,0)
%refline(k,b) k是斜率,b是y轴的截距set(gca,'xtick',[0]);
%只保留x轴set(gca,'ytick',[0]);
%只保留y轴text(0.5,1,'旋转角^o') %标注角度title('法拉第旋转角');xlabel('Ex');ylabel('Ey');axis equalend
51CTO学院12年行业品牌,1600万用户选择,中国专业IT技能学习平台,c#教程.通过在线学习的方式,帮助广大技术人员实现技能提升,高薪就业的职业梦想,c#教程.
matlab里面有三个输入的数么,然后我就想在VS C#也就是那张图的三个空格里面输入数据,然后点按钮得到想画出来的图
希望有好心人给出相关资料也好,谢谢了
额,没人么,我明天去图书馆找找资料好了,这应该是设计交互界面一类的吧
你什么错误?
= =还是没人么,给个参考资料也行啊。。。
Matlab input会停在那里等你输入的,你怎么调用?没用过VS调Matlab的
function xuanzhuan( V,B,d )%法拉第旋转角%{\beta}=V*B*d=O%{\beta}是旋转角弧%V为物质的韦尔代常数%B为磁场强度朝着光波传播方向的分量%d为光波与磁场相互作用的长度O=V*B*d;disp(['旋转角弧=',num2str(O),'rad.']);J=O.*180/(pi);disp(['旋转角度=',num2str(J),'°.']);x0=0;y0=0;theta = J;plot(x0+[0 sind(theta)],y0+[0 cosd(theta)]);set(gca,'xtick',[0]);
%只保留x轴set(gca,'ytick',[0]);
%只保留y轴text(0.5,1,'旋转角^o') %标注角度title('法拉第旋转角');xlabel('Ex');ylabel('Ey');axis equalend
改成这样好像可以?
你先确认一下能不能调用Matlab。作图什么的都是gui,不是简单的算法那么容易 我真的怀疑是否能被c#调用。
真调用不了。。。别人的.cs文件是这样的我的是这样的应该是编译dll的时候就不行吧,这该怎么改
专业从事以亚克力原材料加工制作服务于一体的生产厂家
有vb教程,你找找,翻译一下就能用
登录百度帐号查看: 5818|回复: 6
【混合编程】C#调用matlab
该用户从未签到
按照网上教程,在C#中调用matlab编译产生的.dll文件,在初始化类时出现异常,请问如何解决??
TA的每日心情开心昨天&08:26签到天数: 457 天[LV.9]以坛为家II
出什么异常
该用户从未签到
出什么异常
“test.demo类型初始值设定项引发异常”。test.demo是我在matlab中封装的类, test.demo output = new test.demo();该语句编译时通过,但在调试时显示出该错误。已经将matlab生成的dll文件放置debug目录下,但仍出现该问题
TA的每日心情开心昨天&08:26签到天数: 457 天[LV.9]以坛为家II
我估计是你在这个 test.demo里有调用Webconfig文件的数据,而在你调用的这个项目里有没有这个项,所以为出错的,在那个项目里使用这个Dll就要在那个项目中配置,而不是直接配置在Dll所在项目就行了
该用户从未签到
我估计是你在这个 test.demo里有调用Webconfig文件的数据,而在你调用的这个项目里有没有这个项,所以为出 ...
站长您好,matlab中的代码很简单, 就是按照文库文章的步骤逐步做下来,应该不涉及网络部分的。
TA的每日心情开心昨天&08:26签到天数: 457 天[LV.9]以坛为家II
这个错误报的就是没有取到值的问题呀,
你贴下报错部分的代码,看看有没有访问Config的
该用户从未签到
这个错误报的就是没有取到值的问题呀,
你贴下报错部分的代码,看看有没有访问Config的
未处理 System.TypeInitializationException
&&Message=“test.demo”的类型初始值设定项引发异常。
&&Source=test
&&TypeName=test.demo
&&StackTrace:
& && & 在 test.demo..ctor()
& && & 在 myapp.Form1.button1_Click(Object sender, EventArgs e) 位置 D:\visualstudio2010\Projects\myapp\myapp\Form1.cs:行号 24
& && & 在 System.Windows.Forms.Control.OnClick(EventArgs e)
& && & 在 System.Windows.Forms.Button.OnClick(EventArgs e)
& && & 在 System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
& && & 在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
& && & 在 System.Windows.Forms.Control.WndProc(Message& m)
& && & 在 System.Windows.Forms.ButtonBase.WndProc(Message& m)
& && & 在 System.Windows.Forms.Button.WndProc(Message& m)
& && & 在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
& && & 在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
& && & 在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
& && & 在 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
& && & 在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
& && & 在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
& && & 在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
& && & 在 System.Windows.Forms.Application.Run(Form mainForm)
& && & 在 myapp.Program.Main() 位置 D:\visualstudio2010\Projects\myapp\myapp\Program.cs:行号 18
& && & 在 System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
& && & 在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
& && & 在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
& && & 在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
& && & 在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
& && & 在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
& && & 在 System.Threading.ThreadHelper.ThreadStart()
&&InnerException: System.TypeInitializationException
& && & Message=“MathWorks.MATLAB.NET.Utility.MWMCR”的类型初始值设定项引发异常。
& && & Source=test
& && & TypeName=MathWorks.MATLAB.NET.Utility.MWMCR
& && & StackTrace:
& && && && &在 test.demo..cctor()
& && & InnerException: System.TypeInitializationException
& && && && &Message=“MathWorks.MATLAB.NET.Arrays.MWArray”的类型初始值设定项引发异常。
& && && && &Source=MWArray
& && && && &TypeName=MathWorks.MATLAB.NET.Arrays.MWArray
& && && && &StackTrace:
& && && && && &&&在 MathWorks.MATLAB.NET.Utility.MWMCR..cctor()
& && && && &InnerException: System.BadImageFormatException
& && && && && &&&Message=试图加载格式不正确的程序。 (异常来自 HRESULT:0x8007000B)
& && && && && &&&Source=MWArray
& && && && && &&&StackTrace:
& && && && && && && & 在 MathWorks.MATLAB.NET.Arrays.MWArray.mclmcrInitialize2(Int32 primaryMode)
& && && && && && && & 在 MathWorks.MATLAB.NET.Arrays.MWArray..cctor()
& && && && && &&&InnerException:
///////////////////////////////////////////////////////////////////////
以上就是异常的详细信息。使用MATLAB引擎库函数实现.NET下调用MATLAB_图文_百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
使用MATLAB引擎库函数实现.NET下调用MATLAB
&&比较实用的技术文章,我好不容易找到的
阅读已结束,下载本文需要
想免费下载本文?
定制HR最喜欢的简历
下载文档到电脑,同时保存到云知识,更方便管理
还剩7页未读,继续阅读
定制HR最喜欢的简历
你可能喜欢豆丁微信公众号
君,已阅读到文档的结尾了呢~~
扫扫二维码,随身浏览文档
手机或平板扫扫即可继续访问
使用MATLAB引擎库函数实现_NET下调用MATLAB
举报该文档为侵权文档。
举报该文档含有违规或不良信息。
反馈该文档无法正常浏览。
举报该文档为重复文档。
推荐理由:
将文档分享至:
分享完整地址
文档地址:
粘贴到BBS或博客
flash地址:
支持嵌入FLASH地址的网站使用
html代码:
&embed src='http://www.docin.com/DocinViewer-4.swf' width='100%' height='600' type=application/x-shockwave-flash ALLOWFULLSCREEN='true' ALLOWSCRIPTACCESS='always'&&/embed&
450px*300px480px*400px650px*490px
支持嵌入HTML代码的网站使用
您的内容已经提交成功
您所提交的内容需要审核后才能发布,请您等待!
3秒自动关闭窗口}

我要回帖

更多关于 c 调用matlab引擎 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信