#include "engine.h"
#include "mat.h"
#include <iostream.h>
#include <windows.h>
#include <stdlib.h>
#include <iomanip.h>
void main()
{
double * b,a[9]={1,4,7,2,5,8,3,6,9};
const char *file="mymat.mat";
mxArray *Ain,*Aout,*SV;
Engine * ep;
MATFile *mat;
mat=matOpen(file,"w");
Ain = mxCreateDoubleMatrix(3,3,mxREAL);
mxSetClassName(Ain,"z");
memcpy((char *)mxGetPr(Ain),(char *)a,9*sizeof(double));
matPutVariable(mat,"z",Ain);
matClose(mat);
mxDestroyArray(Ain);
mat=matOpen(file,"r");
Aout =matGetVariable(mat,"z");
if(ep=engOpen(NULL))
{
engPutVariable(ep,"z",Aout);
engEvalString(ep,"sv=svd(z);");
SV=engGetVariable(ep,"sv");
b=mxGetPr(SV);
cout<<"奇异值为";
cout<<"\n";
for(int i=0;i<3;i++)
{
cout<<setw(16)<<b[i];
}
engClose(ep);
matClose(mat);
mxDestroyArray(Aout);
mxDestroyArray(SV);
}
else
cout<<"Can't open matlab";
}
利用VC++6.0集成编程界面编写综合运用MAT数据文件和MATLAB引擎技术的(求矩阵的奇异值)C++源码程序
5星 · 超过95%的资源 需积分: 9 103 浏览量
2009-10-09
10:09:01
上传
评论
收藏 206KB RAR 举报
qwertgbvcxzasdf
- 粉丝: 0
- 资源: 6
最新资源
- Python语言教程1-python批量图片重命名,将后缀某几个不想要的字去除
- Space Combat Kit 太空战斗套件Unity游戏开发插件资源unitypackage C#
- Universal Device Preview 通用设备预览Unity游戏开发插件资源unitypackage
- Paladin Anim Set 圣骑士动画集Unity游戏动作动画插件资源unitypackage
- 计算机财务管理期末考报表部分题目及答案.doc
- 计算机软件维护论文.doc
- 计算机软件著作权授权书.docx
- 计算机键盘教学案例.doc
- 计算流体力学软件平台方案.pptx
- 计量自动化系统介绍.ppt
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈