![]() |
获取矩阵值的大小并按降序对它们进行排序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.