MATLAB: Identify different filname in different group

faqfilenamestrcmp

Hello,
I just realized a program that allows to load data files from a folder. These data files are all different names but I would group them into three groups in matlab. A group 1 whose file names begin with 'X', a group 2 whose file names begin with 'Y' and a group 3 whose file names begin with 'Z' but I do not know how. Do you have any idea? with strcmp?

Best Answer

this is what I needed,
contenu = dir('C:\Users\alexandre\Dropbox\UQTR 2013 - 2015\Matlab\MatLab EPK6064\Fichiers_Travail2');
for file = 1:length(contenu)
Fichiers_Travail2 = contenu(file).name;
if strcmp(Fichiers_Travail2,'.')==0 && strcmp(Fichiers_Travail2,'..')==0 && strcmp(Fichiers_Travail2(1,1),'e')==0
load(Fichiers_Travail2)
if strcmp(Fichiers_Travail2(1,1),'S')==1
code_Groupe = 1;
elseif strcmp(Fichiers_Travail2(1,1),'C')==1
code_Groupe = 2;
elseif strcmp(Fichiers_Travail2(1,1),'L')==1
code_Groupe = 3;
end
end
end