MATLAB Answers

Select a radiobutton.Calculate derivation or integration.

2 views (last 30 days)
oner
oner on 6 Dec 2012
I did a guide.it can calculate function. Than function is written by user in an edit text.My gui shows it at second edit text. problem is this. My gui has two radio button(derivation and integration). I want when user select one of them my program calculate function.if user select integration my program solves integration of function, if user select derivation my progtam solves derivation of function. What i can do ? My progtam :
% --- Executes when selected object is changed in uipanel1. function uipanel1_SelectionChangeFcn(hObject, eventdata, handles)
if(hObject == handles.radiobutton_derivation)
elseif(hObject == handles.radiobutton_integration)
end
% Update handles structure guidata(hObject, handles);
% hObject handle to the selected object in uipanel1 % eventdata structure with the following fields (see UIBUTTONGROUP) % 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)
What must i write in if and elseif ??
Thank you for answer.

Accepted Answer

Matt Fig
Matt Fig on 7 Dec 2012
Edited: Matt Fig on 7 Dec 2012
If you put the code in SelectionChangeFcn, then the integral or derivative will be computed as soon as the user changes radio buttons. Is that really what you want?
If not, I would put the code in the callback where the calculation is made. For example in a pushbutton callback. Here is where you find the selectedobject property and use that in the IF statement.
a = get(handles.edit1,'String');
H = handles;
if H.radiobutton_derivation==get(H.uipanel1,'selectedob')
b = diff(sym(a));
else
b = int(sym(a));
end
set(handles.edit2, 'String', char(b));
  6 Comments
oner
oner on 7 Dec 2012
İt is perfect example. I examined it. I understand my problem. thank you so . i did it :)

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by