File Exchange

image thumbnail

sortBlikeA(A,B)

version 1.0.0.0 (86 Bytes) by Pramit Biswas
sort array B, as the array A is sorted

1 Download

Updated 07 Feb 2018

View License

Ex: sortBlikeA ( [31 53 42 20 15] , [4 8 5 9 1] )
ans =
5 9 8 4 1
Note: tested only for 1D array

Cite As

Pramit Biswas (2021). sortBlikeA(A,B) (https://www.mathworks.com/matlabcentral/fileexchange/65917-sortblikea-a-b), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (1)

Kamil Vlcek

Thank you for the code, I spent two hour searching for the solution, and here it is. How to sort vector B to the same order as is in vector A.

MATLAB Release Compatibility
Created with R2006a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

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

Start Hunting!