MATLAB: Showing certain files in a dialog window

dialog windowfile

Hi,
I want to get a dialog window (uigetfile/uigetdir style) which shows files already filtered by a certain criteria (in this case, modification date being between 2 specified dates). I did discard undesired files by the use of datetime and isbetween:
foldinfo=dir();
foldinfo([foldinfo.isdir]) = [];
tempfile=struct2cell(foldinfo);
[y,m,d]=ymd(datetime(tempfile(2,:)));
c=datetime(y,m,d);
indexs=isbetween(c,Since,To);
foldinfo(indexs)=[];
where "Since" and "To" are datetime format. With this I end up only with the files of interest that I want to be displayed on the dialog box. However, I don't know how to allow the user to select files ONLY among the filtered files.
Does anybody know a way to do this?

Best Answer

Read about listdlg ....
Let str be the files which you have selected and you want user to select from these. This code should help you to do what you want:
[s,v] = listdlg('PromptString','Select a file:',...
'SelectionMode','single',...
'ListString',str) ;
Related Question