MatLab的排序函数-sort .
来源:互联网 发布:淘宝号可以改账户名吗 编辑:程序博客网 时间:2024/05/17 03:17
MatLab排序函数
sort函数的调用格式:
sort(X) 功能:返回对向量X中的元素按列升序排列的新向量。
[Y, I] = sort(A, dim, mode) 功能:对矩阵A的各列或各行重新排序,I记录Y中的元素在排序前A中位置,其中dim指明读A的列还是行进行排序。若dim=1,则按列排序;若dim=2,则按行排序。mode为排序的方式,取值'ascend'为升序,'descend'为降序。
- >> a=[1 2 3;3 9 6;4 10 8 ; 4 0 7]
- a =
- 1 2 3
- 3 9 6
- 4 10 8
- 4 0 7
- >> sort(a)
- ans =
- 1 0 3
- 3 2 6
- 4 9 7
- 4 10 8
- >> sort(a,1)
- ans =
- 1 0 3
- 3 2 6
- 4 9 7
- 4 10 8
- >> sort(a,1,'descend')
- ans =
- 4 10 8
- 4 9 7
- 3 2 6
- 1 0 3
- >> sort(a,2)
- ans =
- 1 2 3
- 3 6 9
- 4 8 10
- 0 4 7
- >> sort(a,2,'descend')
- ans =
- 3 2 1
- 9 6 3
- 10 8 4
- 7 4 0
- >>
>> a=[1 2 3;3 9 6;4 10 8 ; 4 0 7]a = 1 2 3 3 9 6 4 10 8 4 0 7>> sort(a)ans = 1 0 3 3 2 6 4 9 7 4 10 8>> sort(a,1)ans = 1 0 3 3 2 6 4 9 7 4 10 8>> sort(a,1,'descend')ans = 4 10 8 4 9 7 3 2 6 1 0 3>> sort(a,2)ans = 1 2 3 3 6 9 4 8 10 0 4 7>> sort(a,2,'descend')ans = 3 2 1 9 6 3 10 8 4 7 4 0>>
- >> b=[2 5 7 3 9 1 6]
- b =
- 2 5 7 3 9 1 6
- >> [Y,I] = sort(b)
- Y =
- 1 2 3 5 6 7 9
- I =
- 6 1 4 2 7 3 5
- >>
- MatLab的排序函数-sort .
- Matlab的排序函数-sort
- MATLAB中排序函数sort()的用法
- MATLAB中排序函数sort()的用法
- Matlab 用sort函数排序 二维数组
- Matlab 用sort函数排序 二维数组
- Matlab自带排序函数sort用法
- Matlab 用sort函数排序 二维数组
- Matlab自带排序函数sort用法
- matlab sort() 排序函数…
- Matlab自带排序函数sort用法
- matlab sort 函数的使用
- 排序sort()函数的使用
- algorithm的sort排序函数
- matlab sort矩阵排序
- matlab中sort函数的用法
- matlab中sort函数的用法
- matlab中sort函数的用法
- screen命令让断开SSH/TELNET的你依然可以保持程序继续运行工作
- arcgis 具有立体效果的晕渲地图制作
- 连接字符串-sprintf
- 程序员对内存的理解
- android adt18.0.0后不能导入第三方jar源码问题
- MatLab的排序函数-sort .
- 移植32位程序到64位时碰到精度问题
- java中改变方法参数值
- Windows平台下SVN版本控制系统的搭建
- Introduction to algorithm(chapter 13)
- Valgrind: a toolkit of command check over Linux/Unix
- 墨者:美国经济趋于利好,贵金属下行风险不减
- SCNetworkReachability 使用说明
- OpenCV学习笔记(一)——安装配置、第一个程序