Bonjour,

Mon problème traite de l'affichage de checkbox.
je gère des onglets avec des uipanels. Dans un de ces uipanels, je souhaite afficher un nombre de checkbox qui varie en fonction d'un fichier texte que l'on ouvre (on va lire une valeur dans le fichier). Je précise aussi que lorsque je clic sur le bouton pour afficher l'onglet j'appel un fichier dans lequel je gère mon uipanel.

le code du fichier appeler :


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
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
function interface5_2(hp)
%disp(hp)
handles(1,1) = uibuttongroup('parent',hp,....
    'visible','on','Position',[0 0 .2 1]);
 
 
handles(2,1)=uicontrol('parent',handles(1,1),...
    'style','pushbutton',...
    'units','normalized',...
    'position',[0.01 0.94 0.20 0.05],...
    'string','Ouvrir',...    
    'callback',{@recherche_fichier;hp},...
    'tag','recherche_fic');
 
% Create the text uicontrol object result
handles(3,1)=uicontrol('parent',handles(1,1),...
    'style','text',...
    'units','normalized',...
    'position',[0.23 0.95 0.75 0.0275],...
    'string','Emplacement du fichier',...
    'tag','chemin_fic');
 
% Create the text uicontrol object listbox
handles(4,1)=uicontrol('parent',handles(1,1),...
    'style','listbox',...
    'units','normalized',...
    'position',[0.35 0.6 0.23 0.23],...
    'string','voie',...
    'max',3,...
    'min',1,...
    'tag','voie');
 
 
chemin='';
setappdata(gcf,'valeur_de_chemin',chemin);
 
 
 
 
 
 
function recherche_fichier(~,~,h)
.
.
.
 
    x=.88;
    y=1;
    while x>0
        u0(y,1) = uicontrol('parent',h,'Style','checkbox','String',y,...
            'units','normalized','position',[.10 x .31 .02]);
        x=x-.03;
        y=y+1;
    end


PS, cela fonctionne si je met mon while avec uicontrol('parent',hp,... dans la fonction interface5_2(hp)