How do I read the last document from a directory
7 views (last 30 days)
Show older comments
I´ll explain my question:
I have a directory in which new results are posted as new documents everyday and Matlab does a process with the newest to give a results file. How can I set an .m file to choose the newest file everytime?
0 Comments
Accepted Answer
Azzi Abdelmalek
on 13 Mar 2013
Edited: Azzi Abdelmalek
on 13 Mar 2013
d=dir('*.mat'); % if you need mat files
dates={d.date};
files={d.files};
[~,idx]=sort(datenum(dates));
new_file=files{idx(end)}
0 Comments
More Answers (1)
See Also
Categories
Find more on Get Started with MATLAB 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!