matlab reshape使用
来源:互联网 发布:mac os 10.6 dmg下载 编辑:程序博客网 时间:2024/06/05 04:07
reshape把指定的矩阵改变形状,但是元素个数不变,
例如,行向量:
a = [1 2 3 4 5 6]
执行下面语句把它变成3行2列:
b = reshape(a,3,2)
执行结果:
b =
1 4
2 5
3 6
若a=[1 2 3
4 5 6
7 8 9]
使用reshpe后想得到b=[1 2 3 4 5 6 7 8 9]
只需要将a转置一下就可以了:
b=reshape(a',1,9)
----------------------------------------------
a=[
1 2
3 4]
如果使用b=reshape(a,1,4)
则得到的结果是
b=[1 3 2 4]
如果想得到
b=[1 2 3 4]
需要使用
b=reshape(a',1,4)
因为reshape使用的列优先!
b转化回去是同样的道理。
例题如下:
=========================================
- >> a=[1 ,2 ;3,4]
- a =
- 1 2
- 3 4
- >> b=reshape(a,1,4)
- b =
- 1 3 2 4
- >> b=reshape(a',1,4)
- b =
- 1 2 3 4
- >> a=reshape(b,2,2)
- a =
- 1 3
- 2 4
- >> a=reshape(b',2,2)
- a =
- 1 3
- 2 4
0 0
- matlab的reshape使用
- matlab reshape使用
- matlab reshape使用
- matlab reshape
- matlab使用reshape应该注意的问题
- matlab使用reshape应该注意的问题
- matlab使用reshape应该注意的问题
- matlab2c使用c++实现matlab函数系列教程-reshape函数
- matlab——reshape
- MATLAB reshape()函数
- Matlab遍历文件夹,Reshape
- matlab reshape 函数
- matlab reshape函数
- Matlab reshape 函数
- Matlab 的reshape函数
- Matlab 的reshape函数
- matlab之reshape函数
- matlab的reshape函数
- 数据结构(五)之二叉查找树
- ajax回调函数不执行
- c语言中的数组和指针
- python使用队列实现生产者消费者
- Java 多线程
- matlab reshape使用
- Spring中的ContextLoaderListener使用
- html5开发之viewport使用
- 如何用sys as sysdba权限连接数据库进行Exp/Imp
- 任意的进制转换
- centos集群5 常见出错的配置
- 向大家推荐博士数学论坛!
- javascript函数内部用var声明临时变量需要注意的
- 网络是巅峰中的娱乐