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 :

Tableau dans un GUI : comment obtenir les données?


Sujet :

Interfaces Graphiques

  1. #1
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Mars 2015
    Messages
    13
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 32
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Enseignement

    Informations forums :
    Inscription : Mars 2015
    Messages : 13
    Points : 15
    Points
    15
    Par défaut Tableau dans un GUI : comment obtenir les données?
    Bonjour

    Je suis étudiant en Géologie, je ne suis pas un débutant en matlab, mais je n'avais jusque là pas encore exploité les Graphical User Interfaces de matlab.

    J'avais développé une application sous excel que j'aimerais transférer sous matlab afin d'y ajouter plus de fonctionnalités, mais surtout de traiter plus facilement mes données.

    J'ai donc créé un GUI à partir d'un environnement vide. J'ai besoin d'un tableau ou l'on puisse l'utilisateur puisse entrer des données en colonne (Composition molaires de minéraux) et pouvoir moduler le nombre de lignes/ colonnes de données prises en comptes dans les calculs par des checkbox.
    Le fichier fonction.m que crée matlab lors de l'enregistrement du gui me permet facilement de voir apparaître les différentes checkbox. Par contre je n'arrive pas à comprendre ou est défini le tableau et comment récupérer les données.
    Ensuite, un deuxième tableau publierais les données calculées par un algorithme. (Il s'agit en réalité d'un système sur-déterminé, je calcule la solution approchée d'une inversion par la méthode des moindres carrés, ce qui est très simple)

    Je joins une image du fichier .fig du GUI pour mieux visualiser le programme.

    Ma principale interrogation est donc : comment avoir la main sur la tableau et récupérer les données, en utilisant le GUI dans mon programme principal?
    Je ne vois pas apparaitre dans le code de "table" ou autre qui me donnerait la main sur ces fameux tableaux..
    (La question peut paraitre stupide mais je n'ai pas compris comment faire bien que j'ai lu bon nombre de topics)

    Nom : Capture.JPG
Affichages : 219
Taille : 71,9 Ko

    Merci d'avance à ceux qui voudront bien me débloquer!

    TiPi

    Le 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
    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
     
    function varargout = Interface2(varargin)
    %INTERFACE2 M-file for Interface2.fig
    %      INTERFACE2, by itself, creates a new INTERFACE2 or raises the existing
    %      singleton*.
    %
    %      H = INTERFACE2 returns the handle to a new INTERFACE2 or the handle to
    %      the existing singleton*.
    %
    %      INTERFACE2('Property','Value',...) creates a new INTERFACE2 using the
    %      given property value pairs. Unrecognized properties are passed via
    %      varargin to Interface2_OpeningFcn.  This calling syntax produces a
    %      warning when there is an existing singleton*.
    %
    %      INTERFACE2('CALLBACK') and INTERFACE2('CALLBACK',hObject,...) call the
    %      local function named CALLBACK in INTERFACE2.M with the given input
    %      arguments.
    %
    %      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
    %      instance to run (singleton)".
    %
    % See also: GUIDE, GUIDATA, GUIHANDLES
     
    % Edit the above text to modify the response to help Interface2
     
    % Last Modified by GUIDE v2.5 03-Mar-2015 21:13:47
     
    % Begin initialization code - DO NOT EDIT
    gui_Singleton = 1;
    gui_State = struct('gui_Name',       mfilename, ...
                       'gui_Singleton',  gui_Singleton, ...
                       'gui_OpeningFcn', @Interface2_OpeningFcn, ...
                       'gui_OutputFcn',  @Interface2_OutputFcn, ...
                       'gui_LayoutFcn',  [], ...
                       'gui_Callback',   []);
    if nargin && ischar(varargin{1})
       gui_State.gui_Callback = str2func(varargin{1});
    end
     
    if nargout
        [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
    else
        gui_mainfcn(gui_State, varargin{:});
    end
    % End initialization code - DO NOT EDIT
     
     
    % --- Executes just before Interface2 is made visible.
    function Interface2_OpeningFcn(hObject, eventdata, handles, varargin)
    % This function has no output args, see OutputFcn.
    % hObject    handle to figure
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    % varargin   unrecognized PropertyName/PropertyValue pairs from the
    %            command line (see VARARGIN)
     
    % Choose default command line output for Interface2
    handles.output = hObject;
     
    % Update handles structure
    guidata(hObject, handles);
     
    % UIWAIT makes Interface2 wait for user response (see UIRESUME)
    % uiwait(handles.figure1);
     
     
    % --- Outputs from this function are returned to the command line.
    function varargout = Interface2_OutputFcn(hObject, eventdata, handles)
    % varargout  cell array for returning output args (see VARARGOUT);
    % hObject    handle to figure
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    disp(varargout)
    % Get default command line output from handles structure
    varargout{1} = handles.output;
     
     
    % --- Executes on button press in checkbox_Mineral1.
    function checkbox_Mineral1_Callback(hObject, eventdata, handles)
    % hObject    handle to checkbox_Mineral1 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hint: get(hObject,'Value') returns toggle state of checkbox_Mineral1
     
     
    % --- Executes on button press in checkbox_Mineral2.
    function checkbox_Mineral2_Callback(hObject, eventdata, handles)
    % hObject    handle to checkbox_Mineral2 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hint: get(hObject,'Value') returns toggle state of checkbox_Mineral2
     
     
    % --- Executes on button press in checkbox_Mineral3.
    function checkbox_Mineral3_Callback(hObject, eventdata, handles)
    % hObject    handle to checkbox_Mineral3 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hint: get(hObject,'Value') returns toggle state of checkbox_Mineral3
     
     
    % --- Executes on button press in checkbox_Mineral4.
    function checkbox_Mineral4_Callback(hObject, eventdata, handles)
    % hObject    handle to checkbox_Mineral4 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hint: get(hObject,'Value') returns toggle state of checkbox_Mineral4
     
     
    % --- Executes on button press in checkbox_Mineral5.
    function checkbox_Mineral5_Callback(hObject, eventdata, handles)
    % hObject    handle to checkbox_Mineral5 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hint: get(hObject,'Value') returns toggle state of checkbox_Mineral5
     
     
    % --- Executes on button press in checkbox_Mineral6.
    function checkbox_Mineral6_Callback(hObject, eventdata, handles)
    % hObject    handle to checkbox_Mineral6 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hint: get(hObject,'Value') returns toggle state of checkbox_Mineral6
     
     
    % --- Executes on button press in checkbox_Mineral7.
    function checkbox_Mineral7_Callback(hObject, eventdata, handles)
    % hObject    handle to checkbox_Mineral7 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hint: get(hObject,'Value') returns toggle state of checkbox_Mineral7
     
     
    % --- Executes on button press in checkbox_Mineral8.
    function checkbox_Mineral8_Callback(hObject, eventdata, handles)
    % hObject    handle to checkbox_Mineral8 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hint: get(hObject,'Value') returns toggle state of checkbox_Mineral8
     
     
    % --- Executes on button press in checkbox_Mineral9.
    function checkbox_Mineral9_Callback(hObject, eventdata, handles)
    % hObject    handle to checkbox_Mineral9 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hint: get(hObject,'Value') returns toggle state of checkbox_Mineral9
     
     
    % --- Executes on button press in checkbox_Mineral10.
    function checkbox_Mineral10_Callback(hObject, eventdata, handles)
    % hObject    handle to checkbox_Mineral10 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hint: get(hObject,'Value') returns toggle state of checkbox_Mineral10
     
     
    % --- Executes on button press in checkbox_Mineral11.
    function checkbox_Mineral11_Callback(hObject, eventdata, handles)
    % hObject    handle to checkbox_Mineral11 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hint: get(hObject,'Value') returns toggle state of checkbox_Mineral11
     
     
    % --- Executes on button press in checkbox_Mineral12.
    function checkbox_Mineral12_Callback(hObject, eventdata, handles)
    % hObject    handle to checkbox_Mineral12 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hint: get(hObject,'Value') returns toggle state of checkbox_Mineral12
     
     
    % --- Executes on button press in checkbox_Mineral13.
    function checkbox_Mineral13_Callback(hObject, eventdata, handles)
    % hObject    handle to checkbox_Mineral13 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hint: get(hObject,'Value') returns toggle state of checkbox_Mineral13
     
     
    % --- Executes on button press in checkbox_Mineral14.
    function checkbox_Mineral14_Callback(hObject, eventdata, handles)
    % hObject    handle to checkbox_Mineral14 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hint: get(hObject,'Value') returns toggle state of checkbox_Mineral14
     
     
    % --- Executes on button press in checkboxBR.
    function checkboxBR_Callback(hObject, eventdata, handles)
    % hObject    handle to checkboxBR (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hint: get(hObject,'Value') returns toggle state of checkboxBR
     
     
    % --- Executes on button press in Checkbox_comp1.
    function Checkbox_comp1_Callback(hObject, eventdata, handles)
    % hObject    handle to Checkbox_comp1 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hint: get(hObject,'Value') returns toggle state of Checkbox_comp1
     
     
    % --- Executes on button press in Checkbox_comp2.
    function Checkbox_comp2_Callback(hObject, eventdata, handles)
    % hObject    handle to Checkbox_comp2 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hint: get(hObject,'Value') returns toggle state of Checkbox_comp2
     
     
    % --- Executes on button press in Checkbox_comp3.
    function Checkbox_comp3_Callback(hObject, eventdata, handles)
    % hObject    handle to Checkbox_comp3 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hint: get(hObject,'Value') returns toggle state of Checkbox_comp3
     
     
    % --- Executes on button press in Checkbox_comp4.
    function Checkbox_comp4_Callback(hObject, eventdata, handles)
    % hObject    handle to Checkbox_comp4 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hint: get(hObject,'Value') returns toggle state of Checkbox_comp4
     
     
    % --- Executes on button press in Checkbox_comp5.
    function Checkbox_comp5_Callback(hObject, eventdata, handles)
    % hObject    handle to Checkbox_comp5 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hint: get(hObject,'Value') returns toggle state of Checkbox_comp5
     
     
    % --- Executes on button press in Checkbox_comp6.
    function Checkbox_comp6_Callback(hObject, eventdata, handles)
    % hObject    handle to Checkbox_comp6 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hint: get(hObject,'Value') returns toggle state of Checkbox_comp6
     
     
    % --- Executes on button press in Checkbox_comp7.
    function Checkbox_comp7_Callback(hObject, eventdata, handles)
    % hObject    handle to Checkbox_comp7 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hint: get(hObject,'Value') returns toggle state of Checkbox_comp7
     
     
    % --- Executes on button press in Checkbox_comp8.
    function Checkbox_comp8_Callback(hObject, eventdata, handles)
    % hObject    handle to Checkbox_comp8 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hint: get(hObject,'Value') returns toggle state of Checkbox_comp8
     
     
    % --- Executes on button press in Checkbox_comp9.
    function Checkbox_comp9_Callback(hObject, eventdata, handles)
    % hObject    handle to Checkbox_comp9 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hint: get(hObject,'Value') returns toggle state of Checkbox_comp9
     
     
    % --- Executes on button press in Checkbox_comp10.
    function Checkbox_comp10_Callback(hObject, eventdata, handles)
    % hObject    handle to Checkbox_comp10 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hint: get(hObject,'Value') returns toggle state of Checkbox_comp10
     
     
    % --- Executes on button press in Checkbox_comp11.
    function Checkbox_comp11_Callback(hObject, eventdata, handles)
    % hObject    handle to Checkbox_comp11 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hint: get(hObject,'Value') returns toggle state of Checkbox_comp11
     
     
    % --- Executes on button press in Checkbox_comp12.
    function Checkbox_comp12_Callback(hObject, eventdata, handles)
    % hObject    handle to Checkbox_comp12 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hint: get(hObject,'Value') returns toggle state of Checkbox_comp12
     
     
    % --- Executes on button press in Checkbox_comp13.
    function Checkbox_comp13_Callback(hObject, eventdata, handles)
    % hObject    handle to Checkbox_comp13 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hint: get(hObject,'Value') returns toggle state of Checkbox_comp13
     
     
    % --- Executes on button press in button_calculate.
    function button_calculate_Callback(hObject, eventdata, handles)
    % hObject    handle to button_calculate (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
     
    % --- Executes on button press in Checkbox_comp14.
    function Checkbox_comp14_Callback(hObject, eventdata, handles)
    % hObject    handle to Checkbox_comp14 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hint: get(hObject,'Value') returns toggle state of Checkbox_comp14
     
     
    % --- Executes on button press in Checkbox_comp15.
    function Checkbox_comp15_Callback(hObject, eventdata, handles)
    % hObject    handle to Checkbox_comp15 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hint: get(hObject,'Value') returns toggle state of Checkbox_comp15
     
     
    % --- Executes during object creation, after setting all properties.
    function figure1_CreateFcn(hObject, eventdata, handles)
    % hObject    handle to figure1 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    empty - handles not created until after all CreateFcns called

  2. #2
    Invité
    Invité(e)
    Par défaut
    Bonsoir,

    Comme tout objet créé avec GUIDE, celui possède une propriété Tag permettant de l'identifier par la suite et d'y accéder dans le code avec handles.<Tag de ton objet>.
    Dans GUIDE, il suffit de double-cliquer sur l'objet en question et regarder (éventuellement modifier) la valeur associée à la propriété Tag.
    Par défaut, celle-ci devrait être quelque chose comme uitable1, uitable2... à mesure que tu en ajoutes.

    On peut alors accéder aux données saisies par
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    donnees = get(handles.uitable1, 'Data');

Discussions similaires

  1. [Débutant] Comment obtenir les données d'un thread
    Par BasicZX81 dans le forum VB.NET
    Réponses: 3
    Dernier message: 06/02/2014, 20h27
  2. Comment extraire les données d'un fichier txt dans un tableau excel
    Par mirage23 dans le forum Macros et VBA Excel
    Réponses: 1
    Dernier message: 10/11/2012, 09h16
  3. Réponses: 6
    Dernier message: 26/04/2012, 07h42
  4. comment obtenir les données d'un dataform? +childwindow
    Par dhay06 dans le forum Silverlight
    Réponses: 8
    Dernier message: 04/06/2010, 12h20
  5. Réponses: 28
    Dernier message: 08/10/2009, 18h10

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