Buttom group
Publicado por JJ (12 intervenciones) el 10/02/2012 19:06:16
Tengo un buttom group con 3 opciones, según que botón escojas se le da un valor a un parámetro A y B. Después, al pulsar un pushboton quiero que me aparezca una gráfica. Os pongo el código correspondiente:
% --- Executes when selected object is changed in uipanel1.
function uipanel1_SelectionChangeFcn(hObject, eventdata, handles)
% hObject handle to the selected object in uipanel1
% eventdata structure with the following fields (see UIBUTTONGROUP)
if (hObject==handles.uno)
A=1;
B=5;
elseif hObject==handles.dos
A=2;
B=3;
elseif hObject==handles.tres
A=3;
B=1;
end
% EventName: string 'SelectionChanged' (read only)
% OldValue: handle of the previously selected object or empty if none was selected
% NewValue: handle of the currently selected object
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
x=[A A+1 A+2];
y=[B 0 B];
axes(handles.axes1)
plot(x.y)
Me indica que no conocen el valor de A y B. ¿por qué?
% --- Executes when selected object is changed in uipanel1.
function uipanel1_SelectionChangeFcn(hObject, eventdata, handles)
% hObject handle to the selected object in uipanel1
% eventdata structure with the following fields (see UIBUTTONGROUP)
if (hObject==handles.uno)
A=1;
B=5;
elseif hObject==handles.dos
A=2;
B=3;
elseif hObject==handles.tres
A=3;
B=1;
end
% EventName: string 'SelectionChanged' (read only)
% OldValue: handle of the previously selected object or empty if none was selected
% NewValue: handle of the currently selected object
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
x=[A A+1 A+2];
y=[B 0 B];
axes(handles.axes1)
plot(x.y)
Me indica que no conocen el valor de A y B. ¿por qué?
Valora esta pregunta
0