MATLAB: Sorting one field of struct

sorting one field of struct

files=dir('*.dat');
i want to sort files.name of the files struct by file name

Best Answer

[junk, idx] = sort({files.name});
sortedfiles = files(idx);