|
|
| File Information |
| Description |
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'} |
| MATLAB release |
MATLAB 7.0.4 (R14SP2)
|
|
Tags for This File
|
| Everyone's Tags |
|
| Tags I've Applied |
|
| Add New Tags |
Please login to tag files.
|
| Comments and Ratings (7) |
| 26 Jun 2006 |
Mike Palumbo
|
|
|
| 13 Sep 2006 |
F Moisy
|
|
|
| 14 Dec 2006 |
Hans van Dijk
|
|
|
| 02 Aug 2007 |
Gang Xu
|
|
|
| 25 May 2008 |
Nikola Toljic
|
|
|
| 29 Aug 2008 |
Greg Fichter
|
|
|
| 09 Dec 2008 |
Adam Baker
|
|
|
| Updates |
| 18 Sep 2006 |
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. |
| 05 Nov 2008 |
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! |
|
MATLAB Central Terms of Use
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for
all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content.
Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available
via MATLAB Central.
Read the complete Terms prior to use.
Contact us at files@mathworks.com