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.

 Respuesta aceptada

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

Más respuestas (0)

Categorías

Más información sobre MATLAB en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 23 de Abr. de 2021

Respondida:

el 23 de Abr. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by