How to re-order a string array?
Show older comments
currently the files are orderd like this, the value increasing by 30 each time up to 1830:

however, with the code i've used, matlab orders the files like this:

is there any way i can sort the files to match the original?
dirName = pwd;
files = dir( fullfile(dirName,'*.txt') );
files = {files.name}';
files = sortrows(files,'ascend')
Accepted Answer
More Answers (1)
DGM
on 11 Apr 2022
0 votes
1 Comment
james Green
on 11 Apr 2022
Categories
Find more on Shifting and Sorting Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!