Error while evaluating UIControl Callback.
조회 수: 4 (최근 30일)
이전 댓글 표시
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
DGM
2021년 5월 10일
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.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!