matlab2c使用c++实现matlab函数系列教程-rot90函数
来源:互联网 发布:程序源码交易 编辑:程序博客网 时间:2024/04/29 23:44
全栈工程师开发手册 (作者:栾鹏)
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中rot90函数简介
1、blkdiag函数:矩阵逆时针旋转90度
2、用法说明
Y=rot90(X)表示使矩阵X逆时针旋转90度,作为新的矩阵Y,但矩阵X本身不变 Y=rot90(x,n),其中x表示一个矩阵,n为正整数,默认功能:将矩阵x逆时针旋转90*n度,形成新矩阵,x本身不变。
rot90的c++源码实现
矩阵逆时针旋转
矩阵逆时针旋转:输入为一个矩阵及旋转角度(0不旋转,1逆时针旋转90度,2逆时针旋转180度,3逆时针旋转270度)。
Matrix Matlab2c::rot90(Matrix& a,int n){ int i,j; Matrix p; if (n%4==0) { p=a; return p; } else if (n%4==1) { p=Matrix(a.column,a.row); for (i=0;i<a.row;i++) for (j=0;j<a.column;j++) p(p.row-1-j,i) = a(i,j); } else if (n%4==2) { p=Matrix(a.row,a.column); for (i=0;i<a.row;i++) for (j=0;j<a.column;j++) p(p.row-1-i,p.column-1-j) = a(i,j); } else if (n%4==3) { p=Matrix(a.column,a.row); for (i=0;i<a.row;i++) for (j=0;j<a.column;j++) p(j,p.column-1-i) = a(i,j); } return p;}Matrix Matlab2c::rot90(Matrix& a){ return rot90(a,1);}CMatrix Matlab2c::rot90(CMatrix& a,int n){ int i,j; CMatrix p; if (n%4==0) { p=a; return p; } else if (n%4==1) { p=CMatrix(a.column,a.row); for (i=0;i<a.row;i++) for (j=0;j<a.column;j++) p(p.row-1-j,i) = a(i,j); } else if (n%4==2) { p=CMatrix(a.row,a.column); for (i=0;i<a.row;i++) for (j=0;j<a.column;j++) p(p.row-1-i,p.column-1-j) = a(i,j); } else if (n%4==3) { p=CMatrix(a.column,a.row); for (i=0;i<a.row;i++) for (j=0;j<a.column;j++) p(j,p.column-1-i) = a(i,j); } return p;}CMatrix Matlab2c::rot90(CMatrix& a){ return rot90(a,1);}
rot90函数的使用测试
#include "Matlab2c.h"#pragma comment(lib,"Matlab2c.lib") using namespace Matlab2c;int main(){ double a[]={1,2,3,4,5,6}; Matrix aa=Matrix(2,3,a); Matrix cc=Matlab2c::rot90(aa,2); cout<<cc.toString()<<endl; system("pause"); return 0;}
阅读全文
1 0
- matlab2c使用c++实现matlab函数系列教程-rot90函数
- matlab2c使用c++实现matlab函数系列教程-blkdiag函数
- matlab2c使用c++实现matlab函数系列教程-compan函数
- matlab2c使用c++实现matlab函数系列教程-eye函数
- 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函数系列教程-repmat函数
- JAVA中线程同步的方法(7种)汇总
- Android 单例模式的使用
- jvm源码阅读笔记[2]:你不知道的晋升阈值TenuringThreshold详解
- 小小萌新,刚学指针,写一个指针入门只有一点,哇咔咔
- uva-1476 Error Curves 三分
- matlab2c使用c++实现matlab函数系列教程-rot90函数
- poj2432 Anniversary party 入门级树形dp
- CCF 201512-1 数位之和
- AndroidStudio 目录结构
- Html动态时钟实例
- 分布式,集群概念理解
- 【Python】Python3 List min()方法
- Digdata Development Java__Study_13(Java中线程Thread,线程池ExecutorService)
- CF Bear and Tree Jumps树形DP