We have a folder filled with 1000's of folders with different names which we run analysis on. How can I make it so that i am able to filter folders from a certain date range/time range to do the analysis on. We currently have it setup where it can only select folders from a specific date. We use dir to fine the folders from a specific date but want to expand the capabilties of our script.

 채택된 답변

Steven Lord
Steven Lord 2021년 4월 23일
Use datetime arrays and date and time relational calculations.
D = dir(fullfile(matlabroot, 'toolbox', 'matlab', 'demos'));
D(4)
ans = struct with fields:
name: 'AgeVerificationCallback.m' folder: '/MATLAB/toolbox/matlab/demos' date: '23-Apr-2014 16:21:58' bytes: 382 isdir: 0 datenum: 7.3571e+05
inThePastWeek = D(4).date > datetime('today')-calweeks(1) % false
inThePastWeek = logical
0
onOrAfterStartOf2014 = D(4).date > datetime(2014, 1, 1) % true
onOrAfterStartOf2014 = logical
1

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

질문:

2021년 4월 23일

답변:

2021년 4월 23일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by