# Why aren't the permutations from sortslices() available?

**URL:** <https://discourse.julialang.org/t/why-arent-the-permutations-from-sortslices-available/99029>\
**Category:** General Usage\
**Tags:** sort, sortperm\
**Created:** [May 18, 2023, 12:29am UTC](https://discourse.julialang.org/t/why-arent-the-permutations-from-sortslices-available/99029 "2023-05-18T00:29:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![g2g](https://avatars.discourse-cdn.com/v4/letter/g/41988e/32.png) [@g2g](https://discourse.julialang.org/u/g2g)\
**Post date:** [May 18, 2023, 12:29am UTC](https://discourse.julialang.org/t/why-arent-the-permutations-from-sortslices-available/99029/1 "2023-05-18T00:29:55Z")

</div>

I’m writing some data comparison code and it would be helpful if Julia had a sortslicesperm() similar to sortperm() so that a matrix could be sorted (like a vector) by  
`M = rand(0:2, 16, 4); p = sortslicesperm(M, dims=1): M[p,:]`

However, I don’t see a sortslicesperm() in the [sort documentation](https://docs.julialang.org/en/v1/base/sort/). Is that because sortslices() also operates on higher dimensional matrices and those higher dimensional permutations would be too complicated?

---

<div class="post-metadata">

**Author:** ![Gus\_Hart](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gus_hart/32/6987_2.png) [@Gus\_Hart](https://discourse.julialang.org/u/Gus_Hart)\
**Post date:** [March 16, 2024, 6:30pm UTC](https://discourse.julialang.org/t/why-arent-the-permutations-from-sortslices-available/99029/2 "2024-03-16T18:30:05Z")

</div>

This thread might be useful.  
[https://discourse.julialang.org/t/cant-get-sortperm-to-return-the-sorting-order-of-columns-of-a-matrix/84081](https://discourse.julialang.org/t/cant-get-sortperm-to-return-the-sorting-order-of-columns-of-a-matrix/84081)
