Natural-Order Filename Sort

Alphanumeric sort of filenames or filepaths, with customizable number format.

Download
Download

You are now following this Submission

Editor's Note: This file was selected as MATLAB Central Pick of the Week

Cite As

Stephen23 (2026). Natural-Order Filename Sort (https://uk.mathworks.com/matlabcentral/fileexchange/47434-natural-order-filename-sort), MATLAB Central File Exchange. Retrieved .

General Information

MATLAB Release Compatibility

  • Compatible with R2009b and later releases

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
3.4.11

* Add dependency table.

Download
3.4.10

* Update testcases.

Download
3.4.9

* Documentation improvements.

Download
3.4.8

* convert test function to class.

Download
3.4.7

* Add testcases
* Documentation improvements

Download
3.4.6

* Documentation improvements.

Download
3.4.5

* Accept decimal comma as well as decimal point.
* HTML example use string arrays.

Download
3.4.4

* Add testcases.

Download
3.4.3

* Now R2009b compatible.

Download
3.4.2

* Edit description & help.

Download
3.4.1

* Edit description & help.

Download
3.4.0

* Add plenty of testcases.
* Fix bug in descending sort with an empty input array.

Download
3.3.0

* Improve test function, add test cases.
* Rename options nopath->xpath, nodot->rmdot

Download
3.2.0

* Update TESTFUN.
* Fix bug in struct parsing.

Download
3.1.0

* More robust TESTFUN pretty-print code.
* Add NODOT option.

Download
3.0.5

* Improve examples.

Download
3.0.4

* Correct summary.

Download
3.0.3

* Improve string handling.

Download
3.0.2

* Simplify numeric class handling.
* Add permutations test examples.

Download
3.0.1

* handle single element with no number.

Download
3.0.0

* Accepts and sorts the structure returned by DIR.
* Accepts and sorts a string array, categorical array, cell array of char, etc.
* Regular expression and optional arguments may be string or char.

Download
2.1.2

* Consistent alignment tab/spaces.

Download
2.1.1

* Add error IDs.
* Add "noext" option.

Download
2.1.0

* Fix handling of char<num.

Download
2.0.0

* NATSORT total rewrite: faster and less memory.
* Improve HTML documentation.
* Include testcases.

Download
1.6.0

* Add (very useful) debugging output argument.

Download
1.5.0

* Improve blurb and HTML.

Download
1.4.0

* Clearer description of file dependency.
* Improve example of filepath sorting.

Download
1.3.0

* Improve function description.
* Better examples.

Download
1.2.0

- Update documentation only, improve examples.

Download
1.1.0

- Complete acknowledgements.

Download
1.0.0

Download