Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
所以我有一个包含复数值的向量。我想按虚构的升序对它们进行排序。有没有办法做到这一点?
根据排序文档,sort将按大小排序。
sort
谢谢
请尝试这样的事情:
a = [1 + 1i; 1 - 1i; 1 - 2*1i]; [sorted, idx] = sort(imag(a)); a = a(idx); a = 1.0000 - 2.0000i 1.0000 - 1.0000i 1.0000 + 1.0000i