sort_nat: Natural Order Sort
Note de l’éditeur : This file was selected as MATLAB Central Pick of the Week
Natural order sorting sorts strings containing digits in a way such that the numerical value of the digits is taken into account. It is especially useful for sorting file names containing index numbers with different numbers of digits. Often, people will use leading zeros to get the right sort order, but with this function you don't have to do that. For example, with input of
{'file1.txt','file2.txt','file10.txt'}
a normal sort will give you
{'file1.txt','file10.txt','file2.txt'}
whereas, sort_nat will give you
{'file1.txt','file2.txt','file10.txt'}
Citation pour cette source
Douglas Schwarz (2024). sort_nat: Natural Order Sort (https://www.mathworks.com/matlabcentral/fileexchange/10959-sort_nat-natural-order-sort), MATLAB Central File Exchange. Extrait(e) le .
Compatibilité avec les versions de MATLAB
Plateformes compatibles
Windows macOS LinuxCatégories
Tags
Remerciements
A inspiré : BiofilmQ, Depth of field calculator based on 2D digital image correlation data, Customizable Natural-Order Sort, philipptempel/matlab-projectmanagement, Natural-Order Row Sort, Natural-Order Filename Sort, Lilo : Fast and pixel-accurate stitching for 2D tiles, KANTOO, DETEQT
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Découvrir Live Editor
Créez des scripts avec du code, des résultats et du texte formaté dans un même document exécutable.
Version | Publié le | Notes de version | |
---|---|---|---|
1.3.0.0 | Fixed bug identified by Evgeny Pr. (Thanks!) |
||
1.2.0.0 | Added ability to sort in descending order. |
||
1.1.0.0 | Steve Herman identified an obscure bug (sorting a cell array of one string which has no numeric characters) which has now been fixed. Thank you Steve! |
||
1.0.0.0 | Fixed ambiguity of sort order in certain cases e.g., {'a0','a00'}. Increased speed. Relaxed MATLAB version requirements -- no longer requires R2006a, should work with much older versions now. |