Error while evaluating UIControl Callback.

Hi i have an error when im lunching my gui. the problem happens within the uibutton group. the buttons functions are different equation that will be processed upon clicking them
function Execute_Callback(hObject, eventdata, handles)
% hObject handle to Execute (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global s n v kp kv ka e1 e2 e A B C ;
n=str2num(get(handles.Ntxt,'String'));
s=str2num(get(handles.Stxt,'String'));
v=str2num(get(handles.Vtxt,'String'));
A=str2num(get(handles.Atxt,'String'));
B=str2num(get(handles.Btxt,'String'));
C=str2num(get(handles.Ctxt,'String'));
gs=v*(s+A)/((s^n)*(s+B)*(s+C));
kp=gs;
e=1/(1+kp);
kv=s*gs;
e1=1/kv;
ka=(s^2)*(gs);
e2=1/ka;
set(handles.Kptxt,'String',kp);
set(handles.Kvtxt,'String',kv);
set(handles.Katxt,'String',ka);
set(handles.Etxt,'String',e);
set(handles.E1txt,'String',e1)
set(handles.E2txt,'String',e2);
switch (get(evendata.NewValue,'Tag'))
case 'radiobutton1'
num=str2num(get(handles.Numeratortxt,'String'));
den=str2num(get(handles.Denominatortxt,'String'));
sys=tf([num],poly([den]));
D=feedback(sys,1,-1);
rs = tf([1],[1 0]);
cs=rs*D;
impulse(rs,cs)
case 'radiobutton2'
num=str2num(get(handles.Numeratortxt,'String'));
den=str2num(get(handles.Denominatortxt,'String'));
sys=tf([num],poly([den]));
D=feedback(sys,1,-1);
rs = tf([1],[1 0 0]);
cs=rs*D;
impulse(rs,cs)
case 'radiobutton3'
num=str2num(get(handles.Numeratortxt,'String'));
den=str2num(get(handles.Denominatortxt,'String'));
sys=tf([num],poly([den]));
D=feedback(sys,1,-1);
rs = tf([1],[1 0 0 0]);
cs=rs*D;
impulse(rs,cs)
end

1 Kommentar

DGM
DGM am 10 Mai 2021
I don't see anything obvious. Without knowing what the rest of the error message says, I don't know. I can't test it either.
I also don't see why all these variables need to be global if they're also being stored in the handles struct.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Interactive Control and Callbacks finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 10 Mai 2021

Kommentiert:

DGM
am 10 Mai 2021

Community Treasure Hunt

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

Start Hunting!

Translated by