在c#中调用MATLAB函数 [英] Calling MATLAB function in c#
问题描述
大家好!
我试图在我的c#windows窗体应用程序中调用matlab函数。我按照matthworks给出的所有步骤来部署项目。我使用 MathWorks.MATLAB.NET.Arrays包括
Hi all!
I am trying to call matlab function in my c# windows form application. I followed all the steps which are given by matthworks for deploying a project. I included
using MathWorks.MATLAB.NET.Arrays;
using MathWorks.MATLAB.NET.Utility;
还引用了该函数的DLL,即
also a reference to the DLL of that function i.e.
using wavrec;;
但是当我编译项目时给出以下错误
But when I compile the project it gives the following error
C:\Windows\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:TRACE /reference:"C:\Program Files (x86)\MATLAB\R2006b\bin\win32\MWArray.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll" /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Deployment.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll" /reference:..\..\..\..\MATLAB\NNtrain\wavrec\distrib\wavrec.dll /debug:pdbonly /filealign:512 /optimize+ /out:obj\Release\Interface_project.exe /resource:obj\Release\Interface_project.Main.resources /resource:obj\Release\Interface_project.Properties.Resources.resources /resource:obj\Release\Interface_project.TestForm.resources /resource:obj\Release\Interface_project.TrainForm.resources /resource:obj\Release\Interface_project.Training_Patterns.resources /target:winexe Main.cs Main.Designer.cs Program.cs Properties\AssemblyInfo.cs Properties\Resources.Designer.cs Properties\Settings.Designer.cs QuranDataSet.Designer.cs Test.cs Test.Designer.cs Train.cs Train.Designer.cs Training_Patterns.cs Training_Patterns.Designer.cs
c:\Users\Abro\Documents\MATLAB\NNtrain\wavrec\distrib\wavrec.dll: error CS1705: Assembly 'wavrec, Version=0.0.4349.23403, Culture=neutral, PublicKeyToken=null' uses 'MWArray, Version=2.0.0.0, Culture=neutral, PublicKeyToken=e1d84a0da19db86f' which has a higher version than referenced assembly 'MWArray, Version=1.0.2415.7148, Culture=neutral, PublicKeyToken=e1d84a0da19db86f'
我使用的是Windows 7,系统64位,MATLAB 7.6.0,visual studio 2008 >
任何人都可以告诉我可能是什么请问如何解决?
提前谢谢。
I am using windows 7, system 64-bit, MATLAB 7.6.0, visual studio 2008
Can any one tell me what can be the problem and how to solve please?
Thanks in advance.
推荐答案
它字面上告诉你:
It literally tells you that:
uses 'MWArray, Version=2.0.0.0 .. which has a higher version than referenced assembly 'MWArray, Version=1.0.2415.7148
所以你试图从一个使用更新函数的子程序中调用一个函数。
问题是,您使用的是不同版本的dll吗?
So you are trying to call a function from a subroutine, that uses a newer function.
The question is, are you using dlls with different versions?
hi先生
首先你应该从vb.net中的引用添加matlab库然后你可以使用你的代码
有关如何调用matlab的更多信息函数在vb.net访问
www.mathwork.com并搜索vb.net中的调用matlab函数
hi sir
firstly u should add matlab library from reference in vb.net and then u can use ur code
for more information about how to call matlab function in vb.net visit
www.mathwork.com and search about call matlab function in vb.net
这篇关于在c#中调用MATLAB函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!