sortlind(A, varargin)

バージョン 3.0.0.0 (2.66 KB) 作成者: Jos (10584)
sorts input and returns linear indices for parallel sorting
ダウンロード: 2.2K
更新 2018/3/6

ライセンスの表示

sortlind - Sort, returning a linear sort index

B = sortlind(A, ...) equals SORT (A, ...). See the documentation of
sort for details.

[B, I] = sortlind(A, ...) returns a sort index I specifying how
the elements of A were arranged to obtain B. However, in contrast to
sort, these indices are *linear* indices, so that B equals A(I), for
any dimensions and sizes of A. This output can be used to sort
another matrix accordingly.

Examples:
A = [3 4 ; 7 0 ; 5 2]
A2 = 10 * A
[B, I] = sortlind(A) % sort A (along rows)
B2 = A2(I) % parallel sort A2

AA = randi(10,[3 5 2]) % a 3D matrix
[BB, II] = sortlind(AA, 2, 'descend')
isequal(BB,AA(II)) % true!

引用

Jos (10584) (2024). sortlind(A, varargin) (https://www.mathworks.com/matlabcentral/fileexchange/19443-sortlind-a-varargin), MATLAB Central File Exchange. 取得済み .

MATLAB リリースの互換性
作成: R14
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
カテゴリ
Help Center および MATLAB AnswersShifting and Sorting Matrices についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
バージョン 公開済み リリース ノート
3.0.0.0

adapted for recent ML releases

1.0.0.0

fixed some spelling errors