Vb.net MATLAB与visualbasic集成的误差分析
程序很简单,它只是把两个数相加。这是我在.NET汇编中创建和构建的matlab函数Vb.net MATLAB与visualbasic集成的误差分析,vb.net,matlab,Vb.net,Matlab,程序很简单,它只是把两个数相加。这是我在.NET汇编中创建和构建的matlab函数 function out = addMe(a,b) out = a+b; end 然后,我使用NE builder工具箱生成一个.NET组件: 但是当我运行程序时,我得到了以下错误: System.InvalidOperationException was unhandled HResult=-2146233079 Message=An error occurred creating the form.
function out = addMe(a,b)
out = a+b;
end
然后,我使用NE builder工具箱生成一个.NET组件:
但是当我运行程序时,我得到了以下错误:
System.InvalidOperationException was unhandled
HResult=-2146233079
Message=An error occurred creating the form. See Exception.InnerException for details. The error is: Could not load type 'Add.AddClass' from assembly 'Add, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
Source=Add
StackTrace:
at Add.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190
at Add.My.MyProject.MyForms.get_Form1()
at Add.My.MyApplication.OnCreateMainForm() in c:\users\elvin gentiles\documents\visual studio 2013\Projects\Add\Add\My Project\Application.Designer.vb:line 35
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at Add.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.TypeLoadException
HResult=-2146233054
Message=Could not load type 'Add.AddClass' from assembly 'Add, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
Source=Add
TypeName=Add.AddClass
StackTrace:
at Add.Form1..ctor()
InnerException:
您需要在.NET应用程序中添加所需的MatLab组件以运行MatLab函数 遵循此链接,我创建了一个可以让您了解如何添加Matlab程序集的链接: 第二部分 第一部分
希望这有帮助。您是否将Matlab函数部署到.NET中?你试过添加所需的Matlab程序集吗?是的。我使用deploytool将其部署到.NET中。你在说什么?我只是在部署函数时添加类和.m文件。这是图片:在我开始用visual basic编写代码之前,我已经看过了那个视频。我已经导入并添加了所需的引用,但它仍然不起作用。您使用的是.NET的哪个版本?我使用的是Visual Studio2013@elvinguitar:我的意思是.NET版本不是3.5或4.0版本?@elvingitar:我认为高于2.0版本的.NET版本不起作用。尝试使用2.0构建和运行。
System.InvalidOperationException was unhandled
HResult=-2146233079
Message=An error occurred creating the form. See Exception.InnerException for details. The error is: Could not load type 'Add.AddClass' from assembly 'Add, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
Source=Add
StackTrace:
at Add.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190
at Add.My.MyProject.MyForms.get_Form1()
at Add.My.MyApplication.OnCreateMainForm() in c:\users\elvin gentiles\documents\visual studio 2013\Projects\Add\Add\My Project\Application.Designer.vb:line 35
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at Add.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.TypeLoadException
HResult=-2146233054
Message=Could not load type 'Add.AddClass' from assembly 'Add, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
Source=Add
TypeName=Add.AddClass
StackTrace:
at Add.Form1..ctor()
InnerException: