vc++调用MATLAB complier生成的C动态链接库
来源:互联网 发布:辐射避难所 隐藏数据 编辑:程序博客网 时间:2024/05/17 23:00
相信步骤大家都知道,下面上成果
代码如下,英文系统没有中文输入法,而且打中文居然是乱码,不知道咋整,只能用英文注释了
/*the key ideal is to call the function "mlfMrank" which is created by matlab complier,
and i used the command "mcc -B csharedlib:test mrank.m" to generate the c share libaray
which include .dll .h .lib .ctf and so on*/
#include "stdio.h"
#include "test.h"//just with this two header is enough!
void display(const mxArray* in, const char* name);
int main()
{
//initialize the application
if( ! mclInitializeApplication(NULL,0) )
{
fprintf(stderr, "Could not initialize the application./n");
exit(1);
}
//initialize the library
if (!testInitialize())
{
fprintf(stderr,"Could not initialize the library./n");
exit(1);
}
DOUBLE x=10;
mxArray *X,*Y=NULL;//declare input variable x and output variable y that dll function is needed
X=mxCreateDoubleMatrix(1,1,mxREAL);//apply for rooms
memcpy(mxGetPr(X),&x,1*sizeof(double));//assignment
mlfMrank(1,&Y,X);//you could cheak the definition of the function in header file
//"mlfMrank(int nargout, mxArray** r, mxArray* n)"
display(Y,"Y");
mxDestroyArray(X);
mxDestroyArray(Y);
testTerminate();
mclTerminateApplication();
return 0;
}
void display(const mxArray* in, const char* name)
{
int i,j,r,c;
double *data;
data = mxGetPr(in);
r = mxGetM(in);
c = mxGetN(in);
printf("%s = /n",name);
for(i=0;i<r;i++)
{
printf("/t");
for(j=0;j<c;j++)
printf("% 4.2f /t",data[j*r+i]);
printf("/n");
}
printf("/n");
}
- vc++调用MATLAB complier生成的C动态链接库
- vc++调用MATLAB complier生成的C动态链接库(画图)
- vc++调用MATLAB complier生成的C动态链接库(输入参数为字符类型)
- VC调用MatLab生成的动态链接库
- VC调用matlab生成的动态库
- vc调用matlab动态链接库的文件头设置
- C语言调用MATLAB生成的动态链接库的具体方法
- Qt调用VC++生成的动态链接库
- labview调用VC++生成的动态链接库DLL
- VC调用Matlab生成的c
- 【c#】C#调用matlab动态链接库
- vc调用matlab生成的C++dll库总结。
- VC与Matlab混合编程之调用动态链接库dll(C++)——<二>
- vs c调用matlab生成的动态库
- Matlab产生可供VC调用的动态链接库的一种方法
- asp.net下调用Matlab生成动态链接库
- asp.net下调用Matlab生成动态链接库
- VC++中调用MATLAB *.m函数编译后的动态链接库
- poj 1200
- 读取Excel表到DateSet,将DataSet转换成List
- 什么才叫真正的程序设计语言牛人?
- 哪位朋友知道大智慧的指标排序怎么用,请告诉我
- 宽字符串与字符串比较函数
- vc++调用MATLAB complier生成的C动态链接库
- 添加Service Reference, 无法为服务生成代码错误的解决办法
- webkit中image的下载
- 面试系列:分析自我介绍
- 为什么学了却不知道如何解决问题
- 天灰灰
- 外部排序算法即实现(源于国内某搜索引擎公司笔试题给定200G数据,在200M的buffer中排序)
- 《JSP2.0 技术手册》读书笔记四-Listener
- 散列冲突次数测试C语言