hello Sigmund
this is a starter ....
In the middle of my brainstorming I was momentary worried that in 'Struct' the filename and date field seemed not to be consistent
like the first value are :
Timex(1).name = 'T_1_202110010600.jpeg' (and we could interpret that as 01 oct 2021 , 06:00 AM)
but date field gives :
Timex(1).date = '01-Oct-2021 08:14:06'
so after a few seconds of doubt I continued my work assuming that date field is correct and I should not take into account what Timex.name could suggest
Back to the code :
seems that both mat files will give two datenum arrays that do not really match 100% so there is a certain time gap between the two (if plot both you will see it)
now what i wanted to do is :
- find the nearest element in Struct for each element in Week
- remove the elements that are two far apart in terms of time laps ; NB the minimal time delta found here is 52 seconds , so up to you to decide the time tolerance
here I opted to keep only what is below 60 seconds of difference
you simply have to add your own code after imread ;
[v(ci),struct_idx(ci)] = min(abs(dd(ci) - tt));
delta_seconds(ci) = v(ci) * 24 * 60 * 60;
week_ix = find(delta_seconds<=60);
struct_idx = struct_idx(week_ix);
for ck = 1:numel(struct_idx)
folder = Timex(ind).folder;
filename = Timex(ind).name;
F = fullfile(folder,filename);