Doug's MATLAB Video Tutorials

June 3rd, 2010

Find newest file in a directory

4 Responses to “Find newest file in a directory”

  1. Kevin Sheppard replied on :
    !dir /od *.m
    

    at least on Windows

  2. dhull replied on :

    @Kevin,

    Thank you, as with many of my videos the intent is more to take a simple example to show general techniques. This command does solve this specific problem very nicely though.

    Thanks,
    Doug

  3. Vishu replied on :

    Excellent. This was of a great help to me because i have to read files with stamp. However, one small correction. In line 5, replace the ‘~’ with some variable eg. a. What kevin wrote was right though i cudn get how to obtain the latest file name.

  4. dhull replied on :

    @Vishu,

    In newer versions of MATLAB, the ~ means “ignore this outout/input”.

    Doug

Leave a Reply

Wrap code fragments inside <pre> tags, like this:

<pre class="code">
a = magic(3);
sum(a)
</pre>

If you have a "<" character in your code, either follow it with a space or replace it with "&lt;" (including the semicolon).


MathWorks

Doug Hull is a proud MathWorker who is on a mission to help you with MATLAB.

Doug's picture

These postings are the author's and don't necessarily represent the opinions of The MathWorks.