Hi Carlo Speranza,
first of all, get rid of the eval()-command. That is usually not needed, difficult to debug and prone to errors.
One possible way to get similar filenames is to filter utilizing regexp. An example that you can alter to fit your needs you find below:
% test names you would get with dir()-command and fileparts()-command
filenames = {'045_SIW_ETR1000_BS_H1_TL_P8500_Ang+090',...
'046_SIW_ETR1000_BS_H1_TL_P8500_Ang+060',...
'049_SIW_ETR1000_BS_H1_TL_P8500_Ang+030',...
'051_SIW_ETR1000_BS_H1P5_UP_TL_P8500_Ang+090',...
'053_SIW_ETR1000_BS_H1P5_UP_TL_P8500_Ang+090',...
'055_SIW_ETR1000_BS_H1P5_UP_TL_P8500_Ang+090'};
% input from uigetdir and fileparts
fileToLoad = '045_SIW_ETR1000_BS_H1_TL_P8500_Ang+090';
% extract blueprint of name
blueprint = regexp(fileToLoad,'(?<=^\d+)_.+(?=+\d+)','match');
% filter names for similarity
simFileNames = filenames(~cellfun(@isempty,regexp(filenames,sprintf('(?<=^\\d+)%s(?=+\\d+)',blueprint{1}))));
for ik = 1:numel(simFileNames)
DataIn(ik) = load([simFileNames{ik},'.mat']);
end
Kind regards,
Robert