Bonjour,
Je suis en présence d'une fonction de tri , et j'obtiens un tableau contenant ce qui à été choisis , je supprime les éléments redondants :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 set (handles.graph_1,'Enable','on'); nameList = {'Tri_'}; for iIndex = 1:10 Field = sprintf('%s%d', nameList{1},iIndex); if findobj('Tag',Field,'Enable','on') H = handles.(Field); String = get(H, 'String'); Value = get(H, 'Value'); fichier = String{Value} ; if strncmp (fichier ,'ME_',3) tableau{j} = fichier; j=j+1; end end end for i=1:length(tableau) for j=i+1:length(tableau) if strcmp(tableau{i},tableau{j}) tableau{j}= -1; end end end
exemple :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 tableau = 'ME_1.m' 'ME_1.m' 'ME_2.m' 'ME_1.m' tableau = 'ME_1.m' [-1] 'ME_2.m' [-1]
les éléments redondants sont transformés en -1 , toutefois je souhaiterais les supprimer pour les afficher dans un menus ( pour éviter d'avoir un espace )
comment puis je faire ?
Merci
Partager