IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Interfaces Graphiques Discussion :

Message d'erreur "Error using ==> set"


Sujet :

Interfaces Graphiques

  1. #1
    Membre confirmé
    Inscrit en
    Septembre 2009
    Messages
    125
    Détails du profil
    Informations forums :
    Inscription : Septembre 2009
    Messages : 125
    Par défaut Message d'erreur "Error using ==> set"
    Bonjour,

    Je désirerais savoir, à quoi peut être dû les messages d'erreurs du type :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    ??? Error using ==> set
    Invalid handle object.
     
    Error in ==> ResultatsAff at 520
    set(hFigure, 'Windowstyle', 'normal');
     
    Error in ==> StsUteStress>EditResultats at 402
        InfoCarte = ResultatsAff(InfoCarte);
     
    ??? Error while evaluating uimenu Callback
    Voila cela fait maintenant quelques heures que j'essaye de comprendre...

    Merci pour votre aide!

  2. #2
    Rédacteur/Modérateur

    Avatar de Jerome Briot
    Homme Profil pro
    Freelance mécatronique - Conseil, conception et formation
    Inscrit en
    Novembre 2006
    Messages
    20 317
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Freelance mécatronique - Conseil, conception et formation

    Informations forums :
    Inscription : Novembre 2006
    Messages : 20 317
    Par défaut
    Il semble que la variable hFigure ne soit pas un identifiant valide

    Que renvoie ceci ?

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    ishandle(hFigure)
    whos hFigure
    get(hFigure,'type')
    A placer juste avant la ligne 520 dans ResultatsAff

  3. #3
    Membre confirmé
    Inscrit en
    Septembre 2009
    Messages
    125
    Détails du profil
    Informations forums :
    Inscription : Septembre 2009
    Messages : 125
    Par défaut
    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
    ans =
     
         0
     
      Name         Size            Bytes  Class     Attributes
     
      hFigure      1x1                 8  double              
     
    ??? Error using ==> get
    Invalid handle object.
     
    Error in ==> ResultatsAff at 522
    get(hFigure,'type')
     
    Error in ==> StsUteStress>EditResultats at 402
        InfoCarte = ResultatsAff(InfoCarte);
     
    ??? Error while evaluating uimenu Callback
    Voila ce que j'obtiens lorsque je ferme ma fenêtre en cliquant sur la croix en haut a droite

  4. #4
    Rédacteur/Modérateur

    Avatar de Jerome Briot
    Homme Profil pro
    Freelance mécatronique - Conseil, conception et formation
    Inscrit en
    Novembre 2006
    Messages
    20 317
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Freelance mécatronique - Conseil, conception et formation

    Informations forums :
    Inscription : Novembre 2006
    Messages : 20 317
    Par défaut
    Si ISHANDLE renvoie 0, c'est donc que HFigure n'est pas un identifiant valide.

    Il faut donc chercher ou et comment cette variable est affectée dans le code.

    Je ne pense pas que l'on puisse t'en dire beaucoup plus...

  5. #5
    Membre confirmé
    Inscrit en
    Septembre 2009
    Messages
    125
    Détails du profil
    Informations forums :
    Inscription : Septembre 2009
    Messages : 125
    Par défaut
    Voici comment est affectée hFigure :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    hFigure = figure('NumberTitle', 'off', ...
        'Name', TitreTab, ...
        'MenuBar', 'none', ...
        'Resize', 'on', ...
        'Units', 'Pixels', ...
        'Position', [0 0 LargTab HautTab], ...
        'Color', cdf, ...
        'Windowstyle', 'modal', ...
        'Visible', 'off');
    avec :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    TitreTab = 'Résultats';
    et
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    HautFix1 = [40 23 10] ;
    HautFix2 = [  23 23 10 23 23 23 23 23 23 10  23  23  23  23  23 23 23 10 23 23 23 23 23 23 10 23 23 23 6];
    HautVar  = 23*ones(1,m);
    HautLgn  = [HautFix1 HautVar HautFix2];
     
    % Largeur des colonnes 
    LargCol = [6 25 30 55 55 30 80  80  80 6];
     
    % HautTab et LargTab sont la hauteur et la largeur du tableau.
    HautTab = sum(HautLgn); LargTab = sum(LargCol);

    PS : mon aplpication marche parfaitement lorsque je clic sur les boutons ANNULER ou OK, j'ai ce message d'erreur seulement lorsue je ferme ma fenêtre avec la croix en haut a droite.

  6. #6
    Rédacteur/Modérateur

    Avatar de Jerome Briot
    Homme Profil pro
    Freelance mécatronique - Conseil, conception et formation
    Inscrit en
    Novembre 2006
    Messages
    20 317
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Freelance mécatronique - Conseil, conception et formation

    Informations forums :
    Inscription : Novembre 2006
    Messages : 20 317
    Par défaut
    Citation Envoyé par kira9744 Voir le message
    Voici comment est affectée hFigure :
    L'erreur apparaît-elle quand tu fermes la Figure ?

  7. #7
    Membre confirmé
    Inscrit en
    Septembre 2009
    Messages
    125
    Détails du profil
    Informations forums :
    Inscription : Septembre 2009
    Messages : 125
    Par défaut
    seulement lorsque je la ferme avec la croix en haut a droite de la figure

  8. #8
    Rédacteur/Modérateur

    Avatar de Jerome Briot
    Homme Profil pro
    Freelance mécatronique - Conseil, conception et formation
    Inscrit en
    Novembre 2006
    Messages
    20 317
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Freelance mécatronique - Conseil, conception et formation

    Informations forums :
    Inscription : Novembre 2006
    Messages : 20 317
    Par défaut
    Lorsque tu cliques sur la croix rouge, l'objet Figure est détruit, son identifiant n'identifie donc plus rien du tout, ce n'est donc plus un identifiant valide.

    Donc si dans la suite de ton programme, tu te réfères à cet identifiant (ce qui semble être le cas ici) tu obtiens un message d'erreur.

    La propriété CloseRequestFcn de l'objet Figure est-elle modifiée quelque part dans ton code ?

  9. #9
    Membre confirmé
    Inscrit en
    Septembre 2009
    Messages
    125
    Détails du profil
    Informations forums :
    Inscription : Septembre 2009
    Messages : 125
    Par défaut
    non je ne vois aucun "CloseRequestFcn" dans mon code

    Pourrai je eviter ce probleme en controunant ce bout de code avec une boucle if ?

  10. #10
    Rédacteur/Modérateur

    Avatar de Jerome Briot
    Homme Profil pro
    Freelance mécatronique - Conseil, conception et formation
    Inscrit en
    Novembre 2006
    Messages
    20 317
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Freelance mécatronique - Conseil, conception et formation

    Informations forums :
    Inscription : Novembre 2006
    Messages : 20 317
    Par défaut
    Et on pourrait voir le code en entier... sinon on va tourner en boucle

  11. #11
    Membre confirmé
    Inscrit en
    Septembre 2009
    Messages
    125
    Détails du profil
    Informations forums :
    Inscription : Septembre 2009
    Messages : 125
    Par défaut
    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
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    function InfoCarte = ResultatsAff(InfoCarte)
     
     
    %%                                                         Initialisations
    %% Variables et constantes         
    global cdf NumProf;
    Saisie = InfoCarte;
     
    % Titre du tableau :
    TitreTab = 'STS UTE Stress - Résultats';
     
    % Charge le bon type de profil entre les 3 types  possibles
    global NumProf Prof3;
     
    Prof = ValParam('Prof');
     
    switch NumProf
        case '1'
            Profil{1} = Prof{1};
        case '2'
            Profil{1} = Prof{2};
        case '3'
            Profil{1} = Prof3{1};
            Profil{2} = Prof3{2};
            Profil{3} = Prof3{3};
    end
     
     
    %% Calcul des blocs                
    [Result, MTBF, x] = CalculFinal;
     
    % Le tableau comportera m + 16 lignes
    m = numel(Result);              
    MTBF = [MTBF ' heures'];
     
    %% Dimensions du tableau           
    % Chaque cellule est repérée par le couple d'entiers (C,L) où C est le
    % numéro de colonne et L est le numéro de ligne. La première colonne
    % (C = 1) est a gauche et la première ligne (L = 1) est en bas.
     
    % Hauteur des lignes fixes (prévoir 23 pixels par ligne) :
    %     L =   1  m+5 m+6 m+7 m+8 m+9 m+10 m+11 m+12 m+13 m+14
    %     m+15 m+16 ... m+32
    HautFix1 = [40 23 10] ;
    HautFix2 = [  23 23 10 23 23 23 23 23 23 10  23  23  23  23  23 23 23 10 23 23 23 23 23 23 10 23 23 23 6];
    HautVar  = 23*ones(1,m);
    HautLgn  = [HautFix1 HautVar HautFix2];
     
    % Largeur des colonnes (prévoir 6 à 7 pixels par caractère) :
    %     C =  1  2  3  4  5  6  7   8  9  10
    LargCol = [6 25 30 55 55 30 80  80  80 6];
     
    % HautTab et LargTab sont la hauteur et la largeur du tableau.
    % Ces constantes permettent de paramétrer les positions des objets.
    HautTab = sum(HautLgn); LargTab = sum(LargCol); 
     
    % Calcule les coordonnées X,Y de chaque cellule du tableau dans la figure.
    % X et Y sont des réels compris entre 0 et 1.
    [X, Y] = CalculXY(HautLgn, LargCol);
     
    %% Traits du tableau               
    % Chaque cellule est repérée par le couple d'entiers (C,L) 
    % Traits verticaux
    Vert = [
     2     2     2     2    2    2     3    4     5     5   5    7   7    7     7      8   8    8    9   9    9    10   10  10  % C
     2     4   m+7  m+14   m+22  m+29  m+7  m+14  m+7  m+22 m+14  2  4   m+7    m+29   4   m+7  m+29 4   m+7  m+22  4   m+7 m+14     % L_bas
     3   m+5   m+12  m+20  m+27  m+31  m+12 m+20  m+12 m+24 m+20  3  m+5 m+12   m+30  m+5 m+12 m+31 m+5 m+12 m+27  m+5 m+12 m+20 ];  % L_haut
     
    % Traits horizontaux
    HoriFix = [
     2  2     2    2  2   2    2     2    2   2    2     2   2    2    2    2     2     2    2    2    2    2    2    2      2    2         % C_gauche
     7  7    10   10  10  10   10    10   10   10   10    10  10   10   10   10   10    10    9    9    9    9    9    8      8    8        % C_droite
     2  3    m+3  m+4 m+5  m+7  m+8  m+9  m+10 m+11 m+12 m+14 m+15 m+16 m+17 m+18 m+19 m+20 m+22 m+23 m+24 m+25 m+27 m+29  m+30  m+31 ];       % L
     
    HoriVar = [2*ones(1,m); 10*ones(1,m);[4:m+3]];
    Hori = [HoriVar HoriFix];
     
    %% Légendes de la norme            
    % Chaque cellule est repérée par le couple d'entiers (C,L) 
    Lege(2, m+31) = {'\bfCARTE'};
    Lege(2, m+30) = {'Nom :'};
    Lege(2, m+29) = {'Article :'};  Lege(7, m+29) = {'Ind :'};
    Lege(2, m+27) = {'\bfRAPPORT DE CALCUL'};
    Lege(2, m+26) = {'Titre :'};
    Lege(2, m+24) = {'Réf :'};
    Lege(2, m+23) = {'Ed/Rév :'};   Lege(5, m+23) = {'Date :'};
    Lege(2, m+22) = {'Mémo :'};     Lege(5, m+22) = {'Auteur :'};
     
    Lege(2, m+20) = {'\bfSUIVI DES EVOLUTIONS'};
    Lege(2, m+19) = {'Ed/Rév'};     Lege(4, m+19) = {'Date'};   Lege(7, m+19) = {'Modification'};
     
     
    Lege(2, m+12) = {'\bfPROFIL DE MISSION '}; 
    Lege(2, m+11) = {'\fontsize{8}i'};  Lege(3, m+11) = {'({\itt}_{ac})_{i} (°C)'}; Lege(5, m+11) = {'{ \fontsize{14}\it\tau}_{ i}  (%)'}; 
                            Lege(7, m+11) = {'{\itn}_{ i} (/an)'};     Lege(8, m+11) = {'{\DeltaT}_{ i } (°C)'};  
                            Lege(9, m+11) = {'{+\DeltaT}_{J} / 3'}; 
    Lege(2, m+10) = {'\fontsize{8}1'};
    Lege(2, m+9) = {'\fontsize{8}2'};
    Lege(2, m+8) = {'\fontsize{8}3'};
    Lege(2, m+7) = {'\fontsize{8}4'};
     
    for i = 1:length(Profil)
        Lege{3, m-i+11} =  Profil{i}{1};
     
        p = (Profil{i}{2});
        if strcmp(p,'NA')
            Lege{5, m-i+11}=p;
        else
            p = str2num(Profil{i}{2});
         p=p/100;
         p=num2str(p);
         Lege{5, m-i+11} = p;
        end
     
        Lege{7, m-i+11} = Profil{i}{3};
        Lege{9, m-i+11} = Profil{i}{5};
        Lege{8, m-i+11} = Profil{i}{4};
    end             
     
     
    Lege(2, m+5)  = {'\bfTAUX DE DEFAILLANCE'};
    Lege(2, m+4)  = {'\bfBloc fonctionnel'};
    Lege(7, m+4)  = {'\bf  Lambda_b'};
    Lege(8, m+4)  = {'\bf  Lambda_s'};
    Lege(9, m+4)  = {'\bf  Lambda_d'};
     
    for k = 1:m
        Lege{2, k+3} = Result{m-k+1}{1};
        Lege{7, k+3} = [Result{m-k+1}{2}, ' FIT'];
        Lege{8, k+3} = [Result{m-k+1}{3}, ' FIT'];
        Lege{9, k+3} = [Result{m-k+1}{4}, ' FIT'];
    end
     
     
    Lege{7, 4} = ['\bf' Result{m}{2} ' FIT' ];
    Lege(2, 2) = {'\bfMTBF :'};  Lege{4,2} = ['\bf\color{blue}' MTBF];
     
    %%                                                     Construction du gui
    %% Ouvre la figure                 
    hFigure = figure('NumberTitle', 'off', ...
        'Name', TitreTab, ...
        'MenuBar', 'none', ...
        'Resize', 'on', ...
        'Units', 'Pixels', ...
        'Position', [0 0 LargTab HautTab], ...
        'Color', cdf, ...
        'Windowstyle', 'modal', ...
        'Visible', 'off');
    movegui(hFigure, 'center');
     
    %% Insère les objets de contrôle   
    hOK = uicontrol(...
        'Style', 'pushbutton', ...
        'String', 'OK',...
        'Units', 'normalized', ...
        'CallBack', @OK, ...
        'Position', [0.5-105/LargTab 7/HautTab 70/LargTab 25/HautTab]);
     
    hIm = uicontrol(...
        'Style', 'pushbutton', ...
        'String', 'Imprimer', ...
        'Units', 'normalized', ...
        'CallBack', @Imprimer, ...
        'Position', [0.5-35/LargTab 7/HautTab 70/LargTab 25/HautTab]);
     
    hAn = uicontrol(...
        'Style', 'pushbutton', ...
        'String', 'Annuler', ...
        'Units', 'normalized', ...
        'CallBack', @Annuler, ...
        'Position', [0.5+35/LargTab 7/HautTab 70/LargTab 25/HautTab]);
     
    hPanel = uipanel( ...
        'BorderType', 'line', ...
        'BackgroundColor', cdf, ...
        'HighlightColor',  cdf, ...
        'Position', [0 0 1 1]);
     
    hEd1 = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', @Modif, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'CallBack', @Modif1, ...
         'Position',[X(4) Y(m+30)+3/HautTab 219/LargTab 20/HautTab],...
         'String', InfoCarte{1});
     
     hEd2 = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', @Modif2, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'CallBack', @Modif2, ...
         'Position',[X(4) Y(m+29)+3/HautTab 138/LargTab 20/HautTab],...
         'String', InfoCarte{2});
     
    hEd3 = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', @Modif3, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'CallBack', @Modif3, ...
         'Position',[X(7)+33/LargTab Y(m+29)+3/HautTab 45/LargTab 20/HautTab],...
         'String', InfoCarte{3});
     
    hEd4 = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', @Modif4, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'CallBack', @Modif4, ...
         'Position',[X(4) Y(m+26)+3/HautTab 300/LargTab 20/HautTab],...
         'String', InfoCarte{4});
     
    hEd5 = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', @Modif5, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'CallBack', @Modif5, ...
         'Position',[X(4) Y(m+25)+4/HautTab 300/LargTab 20/HautTab],...
         'String', InfoCarte{5});
     
     hEd6 = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', @Modif6, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'CallBack', @Modif6, ...
         'Position',[X(4) Y(m+24)+3/HautTab 300/LargTab 20/HautTab],...
         'String', InfoCarte{6});
     
      hEd7 = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', @Modif7, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'CallBack', @Modif7, ...
         'Position',[X(4) Y(m+23)+2/HautTab 53/LargTab 21/HautTab],...
         'String', InfoCarte{7});
     
       hEd8 = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', @Modif8, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'CallBack', @Modif8, ...
         'Position',[X(6) Y(m+23)+3/HautTab 190/LargTab 20/HautTab],...
         'String', InfoCarte{8});
     
     
       hEd9 = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', @Modif9, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'CallBack', @Modif9, ...
         'Position',[X(4) Y(m+22)+2/HautTab 53/LargTab 20/HautTab],...
         'String', InfoCarte{9});
     
     hEd10 = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', @Modif10, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'CallBack', @Modif10, ...
         'Position',[X(6) Y(m+22)+3/HautTab 190/LargTab 20/HautTab],...
         'String', InfoCarte{10});
     
      hEd11 = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', @Modif11, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'CallBack', @Modif11, ...
         'Position',[X(2)+1/LargTab Y(m+18)+2/HautTab 52/LargTab 20/HautTab],...
         'String', InfoCarte{11});
     
       hEd12 = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', @Modif12, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'CallBack', @Modif12, ...
         'Position',[X(4)+1/LargTab Y(m+18)+2/HautTab 53/LargTab 20/HautTab],...
         'String', InfoCarte{12});
     
        hEd13 = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', @Modif13, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'CallBack', @Modif13, ...
         'Position',[X(5)+2/LargTab Y(m+18)+2/HautTab 323/LargTab 20/HautTab],...
         'String', InfoCarte{13});
     
       hEd14 = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', @Modif14, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'CallBack', @Modif14, ...
         'Position',[X(2)+1/LargTab Y(m+17)+2/HautTab 52/LargTab 20/HautTab],...
         'String', InfoCarte{14});
     
       hEd15 = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', @Modif15, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'CallBack', @Modif15, ...
         'Position',[X(4)+1/LargTab Y(m+17)+2/HautTab 53/LargTab 20/HautTab],...
         'String', InfoCarte{15});
     
        hEd16 = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', @Modif16, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'CallBack', @Modif16, ...
         'Position',[X(5)+2/LargTab Y(m+17)+2/HautTab 323/LargTab 20/HautTab],...
         'String', InfoCarte{16});
     
      hEd17 = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', @Modif17, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'CallBack', @Modif17, ...
         'Position',[X(2)+1/LargTab Y(m+16)+2/HautTab 52/LargTab 20/HautTab],...
         'String', InfoCarte{17});
     
       hEd18 = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', @Modif18, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'CallBack', @Modif18, ...
         'Position',[X(4)+1/LargTab Y(m+16)+2/HautTab 53/LargTab 20/HautTab],...
         'String', InfoCarte{18});
     
        hEd19 = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', @Modif19, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'CallBack', @Modif19, ...
         'Position',[X(5)+2/LargTab Y(m+16)+2/HautTab 323/LargTab 20/HautTab],...
         'String', InfoCarte{19});
     
       hEd20 = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', @Modif20, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'CallBack', @Modif20, ...
         'Position',[X(2)+1/LargTab Y(m+15)+2/HautTab 52/LargTab 20/HautTab],...
         'String', InfoCarte{20});
     
       hEd21 = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', @Modif21, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'CallBack', @Modif21, ...
         'Position',[X(4)+1/LargTab Y(m+15)+2/HautTab 53/LargTab 20/HautTab],...
         'String', InfoCarte{21});
     
        hEd22 = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', @Modif22, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'CallBack', @Modif22, ...
         'Position',[X(5)+2/LargTab Y(m+15)+2/HautTab 323/LargTab 20/HautTab],...
         'String', InfoCarte{22});
     
        hEd23 = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', @Modif23, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'CallBack', @Modif23, ...
         'Position',[X(2)+1/LargTab Y(m+14)+2/HautTab 52/LargTab 20/HautTab],...
         'String', InfoCarte{23});
     
       hEd24 = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', @Modif24, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'CallBack', @Modif24, ...
         'Position',[X(4)+1/LargTab Y(m+14)+2/HautTab 53/LargTab 20/HautTab],...
         'String', InfoCarte{24});
     
        hEd25 = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', @Modif25, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'CallBack', @Modif25, ...
         'Position',[X(5)+2/LargTab Y(m+14)+2/HautTab 323/LargTab 20/HautTab],...
         'String', InfoCarte{25});
     
     
     
    %% Initialisations                 
    % Les axes permettent d'écrire les légendes en utilisant la fonction "text"
    hAxes = axes(...
        'Units', 'normalized', ...
        'Position', [0 0 1 1], ...
        'Visible', 'off');
     
    % Dessine le tableau et écrit les légendes
    DessinTableau(Lege, Vert, Hori, X, Y, LargTab, HautTab);
     
    % Le gui est terminé
    set(hFigure, 'Visible', 'on');
    uiwait(hFigure);
    set(hFigure, 'Windowstyle', 'normal');
    close(hFigure);
     
    %%                                                      Fonctions CallBack
    %% Modifications des champs        
    function Modif1(source,eventdata)
        Saisie{1} = get(hEd1, 'string');
    end
     
    function Modif2(source,eventdata)
        Saisie{2} = get(hEd2, 'string');
    end
     
    function Modif3(source,eventdata)
        Saisie{3} = get(hEd3, 'string');
    end
     
    function Modif4(source,eventdata)
        Saisie{4} = get(hEd4, 'string');
    end
     
    function Modif5(source,eventdata)
        Saisie{5} = get(hEd5, 'string');
    end
     
    function Modif6(source,eventdata)
        Saisie{6} = get(hEd6, 'string');
    end
     
    function Modif7(source,eventdata)
        Saisie{7} = get(hEd7, 'string');
    end
     
    function Modif8(source,eventdata)
        Saisie{8} = get(hEd8, 'string');
    end
     
    function Modif9(source,eventdata)
        Saisie{9} = get(hEd9, 'string');
    end
     
    function Modif10(source,eventdata)
        Saisie{10} = get(hEd10, 'string');
    end
     
    function Modif11(source,eventdata)
        Saisie{11} = get(hEd11, 'string');
    end
     
    function Modif12(source,eventdata)
        Saisie{12} = get(hEd12, 'string');
    end
     
    function Modif13(source,eventdata)
        Saisie{13} = get(hEd13, 'string');
    end
     
    function Modif14(source,eventdata)
        Saisie{14} = get(hEd14, 'string');
    end
     
    function Modif15(source,eventdata)
        Saisie{15} = get(hEd15, 'string');
    end
     
    function Modif16(source,eventdata)
        Saisie{16} = get(hEd16, 'string');
    end
     
    function Modif17(source,eventdata)
        Saisie{17} = get(hEd17, 'string');
    end
     
    function Modif18(source,eventdata)
        Saisie{18} = get(hEd18, 'string');
    end
     
    function Modif19(source,eventdata)
        Saisie{19} = get(hEd19, 'string');
    end
     
    function Modif20(source,eventdata)
        Saisie{20} = get(hEd20, 'string');
    end
     
    function Modif21(source,eventdata)
        Saisie{21} = get(hEd21, 'string');
    end
     
    function Modif22(source,eventdata)
        Saisie{22} = get(hEd22, 'string');
    end
     
    function Modif23(source,eventdata)
        Saisie{23} = get(hEd23, 'string');
    end
     
    function Modif24(source,eventdata)
        Saisie{24} = get(hEd24, 'string');
    end
     
    function Modif25(source,eventdata)
        Saisie{25} = get(hEd25, 'string');
    end
     
    %% Imprimer                        
    function Imprimer(source, eventdata)
        set([hOK, hIm, hAn], 'Visible', 'off');
        set(hPanel, 'Visible', 'off');
        printpreview;
        set([hOK, hIm, hAn], 'Visible', 'on');
        set(hPanel, 'Visible', 'on');
    end
     
    %% OK                              
    function OK(source, eventdata)
        InfoCarte = Saisie;
        uiresume(hFigure);
    end
     
    %% Annuler                         
    function Annuler(source, eventdata)
        uiresume(hFigure);
    end
     
    end

  12. #12
    Rédacteur/Modérateur

    Avatar de Jerome Briot
    Homme Profil pro
    Freelance mécatronique - Conseil, conception et formation
    Inscrit en
    Novembre 2006
    Messages
    20 317
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Freelance mécatronique - Conseil, conception et formation

    Informations forums :
    Inscription : Novembre 2006
    Messages : 20 317
    Par défaut
    Le problème est ici :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    % Le gui est terminé
    set(hFigure, 'Visible', 'on');
    uiwait(hFigure);
    set(hFigure, 'Windowstyle', 'normal');
    close(hFigure);
    Tu crée la Figure en la rendant invisible le temps de créer tous les autres objets puis tu la rends visible. Jusque la aucun problème.

    Ensuite, MATLAB attend patiemment que tu détruise la Figure ou que tu utilise UIRESUME

    Donc quand tu ferme la Figure à l'aide de la croix rouge, MATLAB passe à la ligne suivante et... comme la Figure est détruite, ne trouve pas l'identifiant valide.

    Tu peux donc faire ceci :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    % Le gui est terminé
    set(hFigure, 'Visible', 'on');
    uiwait(hFigure);
    if ishandle(hFigure)
       set(hFigure, 'Windowstyle', 'normal');
       close(hFigure);
    end
    L'autre méthode consiste à fermer la fenêtre dans lesCallbck des boutons :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    %% OK                              
    function OK(source, eventdata)
        InfoCarte = Saisie;
        close(hFigure);
    end
     
    %% Annuler                         
    function Annuler(source, eventdata)
        close(hFigure);
    end
    Dans ce cas, le bout de code précédent devient simplement :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    % Le gui est terminé
    set(hFigure, 'Visible', 'on');
    uiwait(hFigure);

  13. #13
    Membre confirmé
    Inscrit en
    Septembre 2009
    Messages
    125
    Détails du profil
    Informations forums :
    Inscription : Septembre 2009
    Messages : 125
    Par défaut
    Merci beaucoup! sa m'a lair de bien fonctionner

    J'avais penser à la premiere solution avec la boucle if mais j'ai opté pour la seconde voir se que sa donné et that's good!

    Merci Bonne aprem!

  14. #14
    Rédacteur/Modérateur

    Avatar de Jerome Briot
    Homme Profil pro
    Freelance mécatronique - Conseil, conception et formation
    Inscrit en
    Novembre 2006
    Messages
    20 317
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Freelance mécatronique - Conseil, conception et formation

    Informations forums :
    Inscription : Novembre 2006
    Messages : 20 317
    Par défaut
    Une petite simplification de ton code.
    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
     
    hEd(1) = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', {@Modif,1}, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'Position',[X(4) Y(m+30)+3/HautTab 219/LargTab 20/HautTab],...
         'String', InfoCarte{1});
     
     hEd(2) = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', {@Modif,2}, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'Position',[X(4) Y(m+29)+3/HautTab 138/LargTab 20/HautTab],...
         'String', InfoCarte{2});
     
    hEd(3) = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', {@Modif,3}, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'Position',[X(7)+33/LargTab Y(m+29)+3/HautTab 45/LargTab 20/HautTab],...
         'String', InfoCarte{3});
     
    ...
    Et une seule fonction imbriquée Modif :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    function Modif1(source,eventdata,n)
        Saisie{n} = get(hEd(n), 'string');
    end
    ou encore :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    function Modif1(source,eventdata,n)
        Saisie{n} = get(source, 'string');
    end
    Au passage, tu as remplis deux fois la propriété Callback dans chacun des objets Edit (certainement dû un copier./coller)

  15. #15
    Membre confirmé
    Inscrit en
    Septembre 2009
    Messages
    125
    Détails du profil
    Informations forums :
    Inscription : Septembre 2009
    Messages : 125
    Par défaut
    oui en effet je l'avais fait pour un ensuite j'ai continuer en copier coller et en changeant jsute se qui m'interèsse.

    Merci je vais tenir comte de vos remarques pour améliorer tout sa!

  16. #16
    Rédacteur/Modérateur

    Avatar de Jerome Briot
    Homme Profil pro
    Freelance mécatronique - Conseil, conception et formation
    Inscrit en
    Novembre 2006
    Messages
    20 317
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Freelance mécatronique - Conseil, conception et formation

    Informations forums :
    Inscription : Novembre 2006
    Messages : 20 317
    Par défaut
    Tu peux aussi diminuer le nombre de ligne de ton code en affectant d'un seul couops les propriétés communes à tous les Edit.

    Plutôt que

    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
    hEd(1) = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', {@Modif,1}, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'Position',[X(4) Y(m+30)+3/HautTab 219/LargTab 20/HautTab],...
         'String', InfoCarte{1});
     
     hEd(2) = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', {@Modif,2}, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'Position',[X(4) Y(m+29)+3/HautTab 138/LargTab 20/HautTab],...
         'String', InfoCarte{2});
     
    hEd(3) = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', {@Modif,3}, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'Position',[X(7)+33/LargTab Y(m+29)+3/HautTab 45/LargTab 20/HautTab],...
         'String', InfoCarte{3});
    Faire :

    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
    for n = 1:25
    hEd(1) = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', {@Modif,1}, ...
         'Position',[X(7)+33/LargTab Y(m+29)+3/HautTab 45/LargTab 20/HautTab],...
         'String', InfoCarte{1});
     
     hEd(2) = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', {@Modif,2}, ...
         'Position',[X(4) Y(m+29)+3/HautTab 138/LargTab 20/HautTab],...
         'String', InfoCarte{2});
     
     
    hEd(3) = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', {@Modif,3}, ...
         'Position',[X(7)+33/LargTab Y(m+29)+3/HautTab 45/LargTab 20/HautTab],...
         'String', InfoCarte{3});
     
    set(hEd, 'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue')

  17. #17
    Membre confirmé
    Inscrit en
    Septembre 2009
    Messages
    125
    Détails du profil
    Informations forums :
    Inscription : Septembre 2009
    Messages : 125
    Par défaut
    PS ne faudrait il pas enlever le 1 juste devant Modif ??

    Citation Envoyé par Dut Voir le message
    Une petite simplification de ton code.
    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
     
    hEd(1) = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', {@Modif,1}, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'Position',[X(4) Y(m+30)+3/HautTab 219/LargTab 20/HautTab],...
         'String', InfoCarte{1});
     
     hEd(2) = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', {@Modif,2}, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'Position',[X(4) Y(m+29)+3/HautTab 138/LargTab 20/HautTab],...
         'String', InfoCarte{2});
     
    hEd(3) = uicontrol(...
         'Parent', hPanel, ...
         'Style','edit', ...
         'Units','normalized',...
         'CallBack', {@Modif,3}, ...
         'BackgroundColor', 'w', ...
         'HorizontalAlignment', 'left', ...
         'FontSize', 8, ...
         'ForegroundColor', 'blue', ...
         'Position',[X(7)+33/LargTab Y(m+29)+3/HautTab 45/LargTab 20/HautTab],...
         'String', InfoCarte{3});
     
    ...
    Et une seule fonction imbriquée Modif :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    function Modif1(source,eventdata,n)
        Saisie{n} = get(hEd(n), 'string');
    end
    ou encore :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    function Modif1(source,eventdata,n)
        Saisie{n} = get(source, 'string');
    end
    Au passage, tu as remplis deux fois la propriété Callback dans chacun des objets Edit (certainement dû un copier./coller)

  18. #18
    Rédacteur/Modérateur

    Avatar de Jerome Briot
    Homme Profil pro
    Freelance mécatronique - Conseil, conception et formation
    Inscrit en
    Novembre 2006
    Messages
    20 317
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Freelance mécatronique - Conseil, conception et formation

    Informations forums :
    Inscription : Novembre 2006
    Messages : 20 317
    Par défaut
    Citation Envoyé par kira9744 Voir le message
    PS ne faudrait il pas enlever le 1 juste devant Modif ??
    C'était un piège pour savoir si tu suivais

  19. #19
    Membre confirmé
    Inscrit en
    Septembre 2009
    Messages
    125
    Détails du profil
    Informations forums :
    Inscription : Septembre 2009
    Messages : 125
    Par défaut
    Citation Envoyé par Dut Voir le message
    C'était un piège pour savoir si tu suivais
    Je suis bien !!!

    Je vais pouvoir d'optimiser mon code avec vos conseils! MERCI


    Bonjour! j'aimerai revenir sur ce sujet pour vous demander s'il était possible d'empecher l'utilisateur de cliquer sur la croix en haut a gauche d'une fenêtre, celle permettant de la quitter?

    J'ai cherché mais je ne trouve pas comment faire sous matlab...
    Je pensais qu'il était possible de cacher la croix mais je ne vois pas comment faire

  20. #20
    Membre confirmé
    Inscrit en
    Septembre 2009
    Messages
    125
    Détails du profil
    Informations forums :
    Inscription : Septembre 2009
    Messages : 125
    Par défaut
    Bonjour! j'aimerai revenir sur ce sujet pour vous demander s'il était possible d'empecher l'utilisateur de cliquer sur la croix en haut a gauche d'une fenêtre, celle permettant de la quitter?

    J'ai cherché mais je ne trouve pas comment faire sous matlab...
    Je pensais qu'il était possible de cacher la croix mais je ne vois pas comment faire .

Discussions similaires

  1. message d'erreur Syntax error, insert ";" to complete Statement
    Par manguigs dans le forum Débuter avec Java
    Réponses: 2
    Dernier message: 24/03/2009, 13h35
  2. Config Serveur? Message d'erreur "Runtime Error"
    Par Poussy-Puce dans le forum ASP.NET
    Réponses: 6
    Dernier message: 29/08/2007, 23h16
  3. Réponses: 3
    Dernier message: 19/04/2007, 11h34
  4. Obtention du message d'erreur : parse error
    Par orbitalxp dans le forum Langage
    Réponses: 12
    Dernier message: 07/01/2007, 00h29
  5. Message d'erreur : Parse error
    Par mikacontact dans le forum Langage
    Réponses: 3
    Dernier message: 06/12/2006, 13h11

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo