sortwith

Sort elements of several matrices corresponding to the sorting order of one matrix.
415 descargas
Actualizado 6 mar 2016

Ver licencia

his function sorts input matrix A and corresponding matrices using sortrows. Output matrices are sorted such that the first output is a sorted version of A, and all other outputs are sorted in the same order as A. For example,
[B1,B2,...,Bn] = sortwith(A1,A2,...,An) is functionally equivalent to
[B1,ind] = sortrows(A1);
B2 = A2(ind);
.
.
.
Bn = An(ind);

Syntax
B = sortwith(A)
[B1,B2,...,Bn] = sortwith(A1,A2,...,An)
sortwith(...,'descend')

Description
B = sortwith(A) sorts the rows of A in ascending order. Argument A must be either a matrix or a column vector. This usage is exactly equivalent to B = sortrows(A).

[B1,B2,...,Bn] = sortwith(A1,A2,...,An) sorts matrices A1 through An corresponding to the order in which A1 is sorted.

sortwith(...,'descend') sorts the elements in descending order.

Citar como

Chad Greene (2024). sortwith (https://www.mathworks.com/matlabcentral/fileexchange/47515-sortwith), MATLAB Central File Exchange. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2012b
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS Linux
Categorías
Más información sobre Shifting and Sorting Matrices en Help Center y MATLAB Answers.
Etiquetas Añadir etiquetas

Community Treasure Hunt

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

Start Hunting!

sortwith_documentation/html/

Versión Publicado Notas de la versión
3.0.0.0

updated for row or column vectors.

1.1.0.0

Bug fix in descending order; extended functionality to character or cell structures.

1.0.0.0