MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   获取矩阵值的大小并按降序对它们进行排序MATLAB (https://www.labfans.com/bbs/showthread.php?t=26405)

poster 2019-12-14 20:13

获取矩阵值的大小并按降序对它们进行排序MATLAB
 
如何获取矩阵中每个值的大小,因此:

0.2964 0.8765 0.3793 0.6832 -0.4721 0.5571 -0.6674 -0.0941 0.7387 被改造了吗?

0.2964 0.8765 0.3793 0.6832 0.4721 0.5571 0.6674 0.0941 0.7387 以降序方式排序,我们执行sort(A,'descend'),但是由于我有负值,所以我想先给出幅度然后排序,这可以在一条指令中完成吗? (get magnitudes and sort them in descending order)

所以最后我们得到

0.8765 0.7387 0.6832 0.6674 0.5571 0.3793 0.4721 0.2964 0.0941

[B]回答:[/B]

那这个呢:

>> a a = 0.2964 0.8765 0.3793 0.6832 -0.4721 0.5571 -0.6674 -0.0941 0.7387 >> temp=sort(abs(a(:)),'descend') ans = 0.8765 0.7387 0.6832 0.6674 0.5571 0.4721 0.3793 0.2964 0.0941

[url=https://stackoverflow.com/questions/5085496]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 04:52

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.