title: sort a struct from dir in MatLab
body: <p>In MatLab (I got version 2014b, but I can easily update to 2015..) you got the function <code>dir(PATH)</code> from which u receive the content of a directory as a struct.</p>
  
  <p>Now my Problem is, that the entries in the struct are not sorted by file name.
  In my program I let the user select a file with <code>uigetFile</code> and the files are sorted by name there (done by the OS). So the user might select the first file in the dialogue but not be the first file in the <code>fileList</code>.</p>
  
  <p>So my problem is, that the sort of the files in the dialogue of <code>uigetfile</code> is not the same as the function <code>dir</code> returns.</p>
  
  <p>How can achieve that the struct is sorted or the files in the open-dialogue are sorted like in the struct received from <code>dir</code> ?</p>
  
  <p>Here is my directory as struct in <code>fileList</code>:</p>
  
  <pre><code>'.'                 '22-Sep-2015 09:38:42'  0           true    736229,401875000
  '..'                '17-Sep-2015 15:23:37'  0           true    736224,641400463
  'JV_1914_0001.tif'  '21-Sep-2015 09:58:39'  720932      false   736228,415729167
  'JV_1914_0003.tif'  '06-Mrz-2011 18:49:36'  29844547    false   734568,784444445
  'JV_1914_0004.tif'  '06-Mrz-2011 18:49:44'  30382304    false   734568,784537037
  'JV_1914_0005.tif'  '06-Mrz-2011 18:49:50'  30389081    false   734568,784606481
  'JV_1914_0006.tif'  '06-Mrz-2011 18:49:58'  30436100    false   734568,784699074
  'JV_1914_0007.tif'  '06-Mrz-2011 18:50:06'  30442889    false   734568,784791667
  'JV_1914_0008.tif'  '06-Mrz-2011 18:50:14'  31125589    false   734568,784884259
  'JV_1914_0009.tif'  '06-Mrz-2011 18:50:22'  31132367    false   734568,784976852
  'JV_1914_0010.tif'  '06-Mrz-2011 18:50:30'  31080335    false   734568,785069444
  'JV_1914_0011.tif'  '06-Mrz-2011 18:50:36'  31087112    false   734568,785138889
  'JV_1914_0012.tif'  '06-Mrz-2011 18:50:44'  30237671    false   734568,785231482
  'JV_1914_0013.tif'  '06-Mrz-2011 18:50:52'  30244449    false   734568,785324074
  'JV_1914_0014.tif'  '06-Mrz-2011 18:51:00'  30282806    false   734568,785416667
  'JV_1914_0015.tif'  '06-Mrz-2011 18:51:08'  30289585    false   734568,785509259
  'JV_1914_0016.tif'  '06-Mrz-2011 18:51:16'  30294053    false   734568,785601852
  'JV_1914_0017.tif'  '06-Mrz-2011 18:51:24'  30300833    false   734568,785694444
  'JV_1914_0018.tif'  '06-Mrz-2011 18:51:32'  30300833    false   734568,785787037
  'ccc.tif'           '08-Sep-2015 21:28:44'  23332298    false   736215,894953704
  </code></pre>
  
  <p>and as u see is the file <code>ccc.tif</code> at the end of the list while its in the dialogue of <code>uigetfile</code> on the first place (sorted by name - I guess that might be OS-specific) <a href="https://i.stack.imgur.com/ifrJs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ifrJs.png" alt="Dialogue-for File selection"></a></p>