在MATLAB中对矩阵排序时如何维护行? [英] How do I maintain rows when sorting a matrix in MATLAB?

查看:90
本文介绍了在MATLAB中对矩阵排序时如何维护行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个2×3矩阵,我想根据第一列对其进行排序.这是一个示例:

I have a 2-by-3 matrix, and I want to sort it according to the first column. Here's an example:

data   will change to -->  new data
11 33                      10 22
22 44                      11 33 
10 22                      22 44 

我有这段代码可以对矩阵A进行排序,但是效果不佳:

I have this code for sorting a matrix A but it doesn't work well:

sort(A,1,'ascend');

推荐答案

查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆