www.gusucode.com > 利用MATLAB GUI设计滤波器界面,可以设计IIR滤波器 > AFD/SpecifyFilter_LoadStrFilterObject.m
function SpecifyFilter_LoadStrFilterObject(handles) % SpecifyFilter_LoadStrFilterObject is a subfile of the AnalogFilter GUI collection % % James C. Squire, 2002 % Assistant Professor, Virginia Military Institute % ver 1.0 % SpecifyFilter_LoadStrFilterObject sets the ui elements in guiFilterObject % to reflect strFilterObject global strFilterObject % Purpose switch strFilterObject.sPurpose case 'Lowpass' set(handles.uipmPurpose,'Value',1) case 'Highpass' set(handles.uipmPurpose,'Value',2) otherwise error(['Unidentified sPurpose of strFilterObject in ' mfilename]) end % Type switch strFilterObject.sType case 'Bessel' set(handles.uipmType,'Value',1) case 'Butterworth' set(handles.uipmType,'Value',2) case 'Chebychev I' set(handles.uipmType,'Value',3) case 'Chebychev II' set(handles.uipmType,'Value',4) case 'Elliptic' set(handles.uipmType,'Value',5) otherwise error(['Unknown type in ' mfilename]) end % Order set(handles.uipmOrder,'Value',strFilterObject.nOrder) % fc, fcUnits if strFilterObject.fFc >= 1e6 set(handles.uipmFcUnits,'Value',4) set(handles.uitxFc, 'String', num2str(strFilterObject.fFc/1e6)) elseif strFilterObject.fFc >= 1000 set(handles.uipmFcUnits,'Value',3) set(handles.uitxFc, 'String', num2str(strFilterObject.fFc/1e3)) elseif strFilterObject.fFc >= 1 set(handles.uipmFcUnits,'Value',2) set(handles.uitxFc, 'String', num2str(strFilterObject.fFc)) elseif strFilterObject > 0 set(handles.uipmFcUnits,'Value',1) set(handles.uitxFc, 'String', num2str(strFilterObject.fFc*1000)) else error('Fc in strFilterObject is negative') end % Gp set(handles.uitxGp,'String',num2str(strFilterObject.fGp)) % Gs set(handles.uitxGs,'String',num2str(strFilterObject.fGs)) % Gain set(handles.uitxGain,'String',num2str(strFilterObject.fGain)) % status set(handles.uitxStatus,'String',strFilterObject.sStatus) % title set(handles.figSpecifyFilter,'Name',['Analog Filter Designer: ' strFilterObject.sFileName]) % update the dimmed status switch strFilterObject.sType case {'Bessel', 'Butterworth'} set(handles.uitxGp,'Enable','off') set(handles.uitxGpGp,'Enable','off') set(handles.uitxGpdB,'Enable','off') set(handles.uitxGs,'Enable','off') set(handles.uitxGsGs,'Enable','off') set(handles.uitxGsdB,'Enable','off') case 'Chebychev I' set(handles.uitxGp,'Enable','on') set(handles.uitxGpGp,'Enable','on') set(handles.uitxGpdB,'Enable','on') set(handles.uitxGs,'Enable','off') set(handles.uitxGsGs,'Enable','off') set(handles.uitxGsdB,'Enable','off') case 'Chebychev II' set(handles.uitxGp,'Enable','off') set(handles.uitxGpGp,'Enable','off') set(handles.uitxGpdB,'Enable','off') set(handles.uitxGs,'Enable','on') set(handles.uitxGsGs,'Enable','on') set(handles.uitxGsdB,'Enable','on') case 'Elliptic' set(handles.uitxGp,'Enable','on') set(handles.uitxGpGp,'Enable','on') set(handles.uitxGpdB,'Enable','on') set(handles.uitxGs,'Enable','on') set(handles.uitxGsGs,'Enable','on') set(handles.uitxGsdB,'Enable','on') otherwise error(['Unidentified type in ' mfilename]) end