matlab2c使用c++实现matlab函数系列教程-eye函数
来源:互联网 发布:精密仪器编程 编辑:程序博客网 时间:2024/04/29 21:51
全栈工程师开发手册 (作者:栾鹏)
matlab2c动态链接库下载
matlab库函数大全
matlab2c基础教程
matlab2c开发全解教程
matlab2c调用方法:
1、下载动态链接库
2、将Matlab2c.dll拷贝到exe同目录下
3、将Matlab2c.h、Matlab2c.lib放到项目头文件目录下
4、在cpp文件中引入下面的代码
#include "Matlab2c.h"#pragma comment(lib,"Matlab2c.lib") using namespace Matlab2c;
matlab中eye函数简介
1、eye函数:生成单位矩阵
2、用法说明
Y = eye(n) 返回n乘n单一矩阵 Y = eye(m,n) 对角线是1,其他是0
eye的c++源码实现
生成单位矩阵
输入单位矩阵的维数,输出相应大小的单位矩阵。
Matrix Matlab2c::eye(int n){ int i=0,j=0; Matrix a(n,n); for (i=0;i<a.row;i++) for (j=0;j<a.column;j++) if (i==j) a(i,j)=1; else a(i,j)=0; return a;}Matrix Matlab2c::eye(int row,int column){ int i=0,j=0; Matrix a(row,column); for (i=0;i<a.row;i++) for (j=0;j<a.column;j++) if (i==j) a(i,j)=1; else a(i,j)=0; return a;}
eye函数的使用测试
#include "Matlab2c.h"#pragma comment(lib,"Matlab2c.lib") using namespace Matlab2c;int main(){ Matrix aa=Matlab2c::eye(4); cout<<aa.toString()<<endl; Matrix bb=Matlab2c::eye(3,5); cout<<bb.toString()<<endl; system("pause"); return 0;}
阅读全文
2 0
- matlab2c使用c++实现matlab函数系列教程-eye函数
- matlab2c使用c++实现matlab函数系列教程-blkdiag函数
- matlab2c使用c++实现matlab函数系列教程-compan函数
- matlab2c使用c++实现matlab函数系列教程-hankel函数
- matlab2c使用c++实现matlab函数系列教程-hilb函数
- matlab2c使用c++实现matlab函数系列教程-ones函数
- matlab2c使用c++实现matlab函数系列教程-zeros函数
- matlab2c使用c++实现matlab函数系列教程-pascal函数
- matlab2c使用c++实现matlab函数系列教程-toeplitz函数
- matlab2c使用c++实现matlab函数系列教程-wilkinson函数
- matlab2c使用c++实现matlab函数系列教程-diag函数
- matlab2c使用c++实现matlab函数系列教程-tril函数
- matlab2c使用c++实现matlab函数系列教程-triu函数
- matlab2c使用c++实现matlab函数系列教程-fliplr函数
- matlab2c使用c++实现matlab函数系列教程-flipud函数
- matlab2c使用c++实现matlab函数系列教程-reshape函数
- matlab2c使用c++实现matlab函数系列教程-rot90函数
- matlab2c使用c++实现matlab函数系列教程-repmat函数
- 如何选择开源许可证License?
- 私有继承与包含
- SQL SERVER 如何区分大小写
- Let it Bead POJ
- URL(统一资源定位符)
- matlab2c使用c++实现matlab函数系列教程-eye函数
- Java I/O 流
- 1.如何选取版本进行研究
- 机器学习——支持向量机SVM(Support Vector Machine)(上)
- 学习日记
- ubuntu 下的C++多线程遇到的问题(2)--向线程传递参数
- Unable to load annotation processor factory
- umeng(友盟)实现第三方登录和分享详解之登录详解
- 【NOIP2017提高A组模拟8.24】提米树