MATLAB dll in Visual C++
This is my MATLAB function:
if true function [c] = myfittest(x, y) c=x+y; return; end end i have tested the matlab2015a(64bit) and matlab2017a(64bit),and the vs is vs2013(64bit)
if true int main(int argc, char *argv[]) { int a = 4; int b = 3; int c; if (!myfittestInitialize()) //初始化库文件,在.h文件中有定义,Mytest为生成文件名 { cout << "Mytest Initialize failed!"<< endl; return 0; }
mwArray mwa(1, 1, mxUINT32_CLASS); //给输入参数A赋值 mwa.SetData(&a, 1);
mwArray mwb(1, 1, mxUINT32_CLASS); //给输入参数B赋值 mwb.SetData(&b, 1);
mwArray mwy(1, 1, mxUINT32_CLASS);
myfittest(1, mwy, mwa, mwb); //调用test函数,该函数在.h中有定义 //第一个参数:.m文件中test函数对应的输出参数个数 //第二个参数:.m文件中test函数对应的输出参数C //第三个参数:.m文件中test函数对应的输入参数A //第四个参数:.m文件中test函数对应的输入参数B mwy.GetData(&c, 1); //获取test计算结果C
cout c << endl; myfittestTerminate(); //结束end 在.h中有定义 } end the error is <</matlabcentral/answers/uploaded_files/104358/QQ%E5%9B%BE%E7%89%8720180211193931.png> and when i add the the environment variables of the mclmcrrt8_5.dll
, the myfittestInitialize() return fail
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!