Matlab引擎2014a赢得';t在Windows 7 64位下启动-缺少2013a dll 我不能用Matlab 2014A、Wi764位、64位的编译器从VC++或VS2013、英特尔编译器中用C++程序启动MATLAB引擎。我可以使用Matlab 2013a很好地启动发动机。如果我链接到2014a,程序会抱怨libmwmfl_scalar.dll丢失并且无法启动。这是2013年附带的dll,但似乎不再包含在2014a中(程序或编译器运行时发行版中)。如果我链接到2013a,它运行没有问题。当我更新到2014a时,为什么它会坚持使用旧的DLL?我已将所有包括、libs和环境更改为2014a,并在清洁后重建。我在属性中没有明确引用libmwmfl_scalar.dll,并已将所有文件夹更改为2014a。我没有链接到任何其他使用Matlab的东西。如果在链接的可执行文件上运行dependency walker,则不会显示此dll
这些设置与另一篇文章()中的属性页相同,后者提供了一些相关的上下文Matlab引擎2014a赢得';t在Windows 7 64位下启动-缺少2013a dll 我不能用Matlab 2014A、Wi764位、64位的编译器从VC++或VS2013、英特尔编译器中用C++程序启动MATLAB引擎。我可以使用Matlab 2013a很好地启动发动机。如果我链接到2014a,程序会抱怨libmwmfl_scalar.dll丢失并且无法启动。这是2013年附带的dll,但似乎不再包含在2014a中(程序或编译器运行时发行版中)。如果我链接到2013a,它运行没有问题。当我更新到2014a时,为什么它会坚持使用旧的DLL?我已将所有包括、libs和环境更改为2014a,并在清洁后重建。我在属性中没有明确引用libmwmfl_scalar.dll,并已将所有文件夹更改为2014a。我没有链接到任何其他使用Matlab的东西。如果在链接的可执行文件上运行dependency walker,则不会显示此dll,c++,matlab,visual-studio,matlab-engine,C++,Matlab,Visual Studio,Matlab Engine,这些设置与另一篇文章()中的属性页相同,后者提供了一些相关的上下文 <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ImportGroup Label="PropertySheets" /> <PropertyGroup Label="Us
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<LocalDebuggerEnvironment>PATH=C:\Program Files\MATLAB\R2014a\bin\win64;%PATH%$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>C:\Program Files\MATLAB\R2014a\extern\include;C:\Program Files\MATLAB\R2014a\extern\include\win64</AdditionalIncludeDirectories>
<PreprocessorDefinitions>IBMPC</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>C:\Program Files\MATLAB\R2014a\extern\lib\win64\microsoft</AdditionalLibraryDirectories>
<AdditionalDependencies>libmx.lib;libmex.lib;libmat.lib;libeng.lib;mclmcrrt.lib</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup />
</Project>
PATH=C:\Program Files\MATLAB\R2014a\bin\win64;%路径%$(本地调试环境)
C:\Program Files\MATLAB\R2014a\extern\include;C:\ProgramFiles\MATLAB\R2014a\extern\include\win64
IBMPC
C:\ProgramFiles\MATLAB\R2014a\extern\lib\win64\microsoft
libmx.lib;libmex.lib;libmat.lib;libeng.lib;mclmcrrt.lib
本-不,我没有使用Mex文件。这是调用Matlab的代码
void mlsurfaceplot(std::vector<std::vector<double>> surface,std::vector<double> Xdat,std::vector<double> Ydat)
{
Engine *ep;
mxArray *Xmx = NULL, *result = NULL;
mxArray *Ymx=NULL;
mxArray *Zmx=NULL;
char buffer[BUFSIZE+1];
// double tim[10] = { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 };
//Have to stick vectors in arrays for Matlab xfer
double *xArray; //Declare pointer to type of array
xArray = new double[Xdat.size()]; //use 'new' to create array of size x
double *yArray; //Declare pointer to type of array
yArray = new double[Ydat.size()]; //use 'new' to create array of size x
double *zArray; //Declare pointer to type of array
zArray = new double[Xdat.size()*Ydat.size()]; //use 'new' to create array of size x
for (int j = 0; j < Xdat.size(); j++)
{
xArray[j]=Xdat[j];
}
for (int j = 0; j < Ydat.size(); j++)
{
yArray[j]=Ydat[j];
}
for (int i = 0; i < Xdat.size(); i++)
{
for (int j = 0; j < Ydat.size(); j++)
{
zArray[i+Xdat.size()*j]=surface[i][j];
}
}
/*
* Call engOpen with a NULL string. This starts a MATLAB process
* on the current host using the command "matlab".
*/
if (!(ep = engOpen(""))) {
fprintf(stderr, "\nCan't start MATLAB engine\n");
//return EXIT_FAILURE;
}
/*
* Create a variable for our data
*/
using namespace std;
Xmx = mxCreateDoubleMatrix(1,Xdat.size(), mxREAL);
Ymx = mxCreateDoubleMatrix(1,Ydat.size(), mxREAL);
Zmx = mxCreateDoubleMatrix(Xdat.size(), Ydat.size(), mxREAL);
//T = mxCreateDoubleMatrix(3, 2, mxREAL);
//memcpy((void *)mxGetPr(T), (void *)tim, sizeof(tim));
memcpy(mxGetPr(Xmx), &xArray[0], sizeof(double)*Xdat.size());
memcpy(mxGetPr(Ymx), &yArray[0], sizeof(double)*Ydat.size());
memcpy(mxGetPr(Zmx), &zArray[0], sizeof(double)*Xdat.size()*Ydat.size());
//std::cout<<T[0]<<std::endl;
/*
* Place the variable T into the MATLAB workspace
*/
engPutVariable(ep, "X", Xmx); engPutVariable(ep, "Y", Ymx);
engPutVariable(ep, "Z", Zmx);
std::cout<<*mxGetPr(Xmx)<<std::endl;
std::cout<<*mxGetPr(Ymx)<<std::endl;
std::cout<<*mxGetPr(Zmx)<<std::endl;
std::cout<<*(mxGetPr(Xmx)+1)<<std::endl;
std::cout<<*(mxGetPr(Ymx)+1)<<std::endl;
std::cout<<*(mxGetPr(Zmx)+1)<<std::endl;
/*
* Plot the result
*/
engEvalString(ep, "surf(X,Y,Z')");
engEvalString(ep, "ylabel('Log Spot/Strike')");
engEvalString(ep, "xlabel('Expiry (Years)')");
engEvalString(ep, "zlabel('Black 76 Vol')");
engEvalString(ep, "alpha(0.5)");
engEvalString(ep,"saveas(figure1,'c:\\users\\Rodney\\Documents\\filename2.jpg'),'jpg'");
/*
* use fgetc() to make sure that we pause long enough to be
* able to see the plot
*/
printf("Hit return to continue\n\n");
fgetc(stdin);
int jj;
cin>>jj;
/*
* We're done for Part I! Free memory, close MATLAB figure.
*/
printf("Done for Part I.\n");
mxDestroyArray(Xmx);
mxDestroyArray(Ymx);
mxDestroyArray(Zmx);
// mxDestroyArray(T);
engEvalString(ep, "close;");
// return 0;
}
void mlsurfaceplot(std::vector surface,std::vector Xdat,std::vector Ydat)
{
发动机*ep;
mxArray*Xmx=NULL,*result=NULL;
mxArray*Ymx=NULL;
mxArray*Zmx=NULL;
字符缓冲区[BUFSIZE+1];
//双tim[10]={0.0,1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0};
//必须为Matlab xfer在数组中粘贴向量
double*xArray;//声明指向数组类型的指针
xArray=new double[Xdat.size()];//使用“new”创建大小为x的数组
double*yArray;//声明指向数组类型的指针
yArray=new double[Ydat.size()];//使用“new”创建大小为x的数组
double*zArray;//声明指向数组类型的指针
zArray=new double[Xdat.size()*Ydat.size()];//使用“new”创建大小为x的数组
对于(int j=0;j //std::coutNo-mex文件,对吗?@Rod:尝试将MATLAB R2014a重新注册为COM服务器:(您需要以管理员权限运行此程序)。此外,如果您检查路径
环境变量(只需打开cmd.exe命令提示符,运行echo%PATH%
,然后在问题中发布输出结果),也会有所帮助Ben-不,我没有使用Mex文件。我在我的问题中添加了调用Matlab的函数。Amro-谢谢,我尝试将2014a重新注册为COM服务器。重新注册工作正常,但我的程序仍在查找旧的DLL。在重新注册2014a并从路径中删除2013a后,我希望Visual Studio甚至不知道关于2013a的任何信息,但是仍在查找2013a DLL。我已在上面添加了路径。