I run this code and if I click yes without change anything in the inputdlg, I receive 's/s'. How can I return this to '1' in this situation?
prompt={'Proportional Coefficient Input','Integral Coefficient Input','Derivative Coefficient Input'};defans={'1','0','0'};answer=inputdlg(prompt,'PID Coefficient Input',1,defans,'on');if (~isempty(answer)) if (~isempty(answer{1}))&(~isempty(answer{2}))&(~isempty(answer{3}))&(answer{1}~='0') syms s x1=str2num(answer{1}); x2=str2num(answer{2}); x3=str2num(answer{3}); handles.pid(1)=x1(1); handles.pid(2)=x2(1); handles.pid(3)=x3(1); handles.PID_num=[handles.pid(3),handles.pid(1),handles.pid(2)]; handles.PID_den=[1,0]; handles.PID_sys=tf(handles.PID_num,handles.PID_den); evalc('handles.PID_sys')end end
Best Answer