CSORT

Sorts complex arrays. Six different methods are available.
ダウンロード: 1.8K
更新 2006/1/11

ライセンスの表示

For vectors, CSORT(X) sorts the elements of X in ascending order.

For matrices, CSORT(X) sorts each column of X in ascending order.

The standard method is a lexical sort, first sort by real part,then by imaginary part.

Y = CSORT(X,METHOD,DIM,MODE)
has three optional parameters.

METHOD selects the method of the sort
'lexi' lexical sort, sort first by REAL(X), then by IMAG(X)
'angle' sort by phase angle, ANGLE(X)
'abs' sort by magnitude, ABS(X)
'real' sort by real part, REAL(X)
'imag' sort by imaginary part, imag(X)
'absangle' sort first by ABS(X), then ANGLE(X) (Matlab standard)

DIM selects a dimension along which to sort.

MODE selects the direction of the sort
'ascend' results in ascending order
'descend' results in descending order

The MODE option is not valid for lexical sorting.

The result is in Y which has the same shape and type as X

[Y,I] = CSORT(X,METHOD,DIM,MODE) also returns an index matrix I.

If X is a vector, then Y = X(I).
If X is an m-by-n matrix and DIM=1, then
for j = 1:n, Y(:,j) = X(I(:,j),j); end

引用

Peter (PB) Bodin (2024). CSORT (https://www.mathworks.com/matlabcentral/fileexchange/9552-csort), MATLAB Central File Exchange. 取得済み .

MATLAB リリースの互換性
作成: R14SP3
すべてのリリースと互換性あり
プラットフォームの互換性
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!
バージョン 公開済み リリース ノート
1.0.0.0

Changed the summary