Bonjour,
je souhaite créer sous guide une GUI avec ;
1- Des variables initialisés des le lancement
2- Variable globales qui s'affiche sur le workspace des le lancement
3- Variables que je peux modifier a partir de ma GUI et les voir sous le workspace sous la forme matricielle, toutes mes valeurs modifié sont enregistrés dans mes variable.
4-enregistrer les valeurs de mes variables

pour cela l'utilisation de appdata avec les setappdata et getappdata est recommande selon ma lecture.

voici le code que j'ai commencé mais je n'arrive pas avec appdata.

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
function varargout = test111(varargin)


% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @test111_OpeningFcn, ...
                   'gui_OutputFcn',  @test111_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 test111 is made visible.
function test111_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   command line arguments to test111 (see VARARGIN)

% Choose default command line output for test111
handles.output = hObject;

global a b;
a=0;
b=0;
set(handles.ValeurEntree, 'string',a)
set(handles.ValeurEntree, 'string',b)

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes test111 wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = test111_OutputFcn(hObject, eventdata, handles) 

varargout{1} = handles.output;

function ValeurEntree_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.
function ValeurEntree_CreateFcn(hObject, eventdata, handles)

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)

global a

a = str2double(get(handles.ValeurEntree,'string'))
set(handles.DerniereValeur,'string',a)

function DerniereValeur_Callback(hObject, eventdata, handles)



% --- Executes during object creation, after setting all properties.
function DerniereValeur_CreateFcn(hObject, eventdata, handles)

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end
Nom : keuv.jpg
Affichages : 469
Taille : 38,5 Ko