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
| function testcarreinverse2_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 testcarreinverse2 (see VARARGIN)
% Choose default command line output for testcarreinverse2
handles.output = hObject;
X=[0:10]
Y=X.^(-1)
Z=X.^2
handles.inverse=Y;
handles.carre=Z;
handles.current_data=handles.carre;
% Update handles structure
guidata(hObject, handles);
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu1 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu1
val=get(hObject,'Value');
str=get(hObject,'String');
switch str{val}
case 'inverse'
handles.current_data=handles.inverse;
plot(X, handles.current_data,'*r');
case 'carre'
handles.current_data=handles.carre;
plot(X, handles.current_data,'*r');
otherwise
end
guidata(hObject, handles); |
Partager