?? gui.m
字號(hào):
function varargout = GUI(varargin)% GUI Application M-file for GUI.fig% FIG = GUI launch GUI GUI.% GUI('callback_name', ...) invoke the named callback.%% Author: Pranam Janney Date: 15/05/04 Time: 17:50 % Email: pranamjanney@yahoo.comif nargin == 0 % LAUNCH GUI fig = openfig(mfilename,'reuse'); % Use system color scheme for figure: set(fig,'Color',get(0,'defaultUicontrolBackgroundColor')); % Generate a structure of handles to pass to callbacks, and store it. handles = guihandles(fig); % Initialising structure variables to be used in program handles.data = 0; % used for storing the Num_of_samples value handles.data1 = 0; % used for storing the Slider values handles.data3 = 0; % used for storing the number of times the push button is pressed handles.data4(1,8) = ' '; % Array to store the numbers dialled handles.chk = 0; % To check if the Number of samples is used or not guidata(fig, handles); if nargout > 0 varargout{1} = fig; endelseif ischar(varargin{1}) % INVOKE NAMED SUBFUNCTION OR CALLBACK try if (nargout) [varargout{1:nargout}] = feval(varargin{:}); % FEVAL switchyard else feval(varargin{:}); % FEVAL switchyard end catch disp(lasterr); endend% --------------------------------------------------------------------function varargout = pushbutton1_Callback(h, eventdata, handles, varargin)% To check for Nif handles.chk == 0 N = 205;else N = handles.data; % Number of samplesendNP = handles.data1; % Noise Powerhandles.data3 = handles.data3 + 1; % to keep track of number of times push buttons are used% Generator[x,v,snr] = generator(1,N,NP);size(x);% Display SNRset(handles.edit3,'String',snr)% To plot on GUIf = 1:N;axes(handles.Out_dtmf) % Select the proper axesplot(f,x(1:N))set(handles.Out_dtmf,'XMinorTick','on')grid on% Decoder[D,m] = decoder(x,N);size(m);% To append each dialled digit into an array (max 8 numbers)[handles.data4,handles.data3] = StringNum(handles.data4,D,handles.data3);% After 8th digit the next number is put into first digit placeif handles.data4 == ' ' handles.data4(handles.data3) = D;end% To display the dialled numbers set(handles.edit2,'String',handles.data4); % The dialled number as decoded by the decoder % is displayed on the edit text% To plot the output f = 1 : length(m);axes(handles.G_output) % Select the proper axesplot(f,m)set(handles.G_output,'XMinorTick','on')grid onguidata(h,handles);% --------------------------------------------------------------------function varargout = pushbutton2_Callback(h, eventdata, handles, varargin)% To check for Nif handles.chk == 0 N = 205;else N = handles.data; % Number of samplesend % Number of samplesNP = handles.data1; % Noise Powerhandles.data3 = handles.data3 + 1; % to keep track of number of times push buttons are used% Generator[x,v,snr] = generator(2,N,NP);size(x);% Display SNRset(handles.edit3,'String',snr)% To plot on GUIf = 1:N;axes(handles.Out_dtmf) % Select the proper axesplot(f,x(1:N))set(handles.Out_dtmf,'XMinorTick','on')grid on% Decoder[D,m] = decoder(x,N);size(m);% To append each dialled digit into an array (max 8 numbers)[handles.data4,handles.data3] = StringNum(handles.data4,D,handles.data3);% After 8th digit the next number is put into first digit placeif handles.data4 == ' ' handles.data4(handles.data3) = D;end% To display the dialled numbers set(handles.edit2,'String',handles.data4); % The dialled number as decoded by the decoder % is displayed on the edit text% To plot the output f = 1 : length(m);axes(handles.G_output) % Select the proper axesplot(f,m)set(handles.G_output,'XMinorTick','on')grid onguidata(h,handles);% --------------------------------------------------------------------function varargout = pushbutton3_Callback(h, eventdata, handles, varargin)% To check for Nif handles.chk == 0 N = 205;else N = handles.data; % Number of samplesendNP = handles.data1; % Noise Powerhandles.data3 = handles.data3 + 1; % to keep track of number of times push buttons are used% Generator[x,v,snr] = generator('A',N,NP);size(x);% Display SNRset(handles.edit3,'String',snr)% To plot on GUIf = 1:N;axes(handles.Out_dtmf) % Select the proper axesplot(f,x(1:N))set(handles.Out_dtmf,'XMinorTick','on')grid on% Decoder[D,m] = decoder(x,N);size(m);% To append each dialled digit into an array (max 8 numbers)[handles.data4,handles.data3] = StringNum(handles.data4,D,handles.data3);% After 8th digit the next number is put into first digit placeif handles.data4 == ' ' handles.data4(handles.data3) = D;end% To display the dialled numbers set(handles.edit2,'String',handles.data4); % The dialled number as decoded by the decoder % is displayed on the edit text% To plot the output f = 1 : length(m);axes(handles.G_output) % Select the proper axesplot(f,m)set(handles.G_output,'XMinorTick','on')grid onguidata(h,handles);% --------------------------------------------------------------------function varargout = pushbutton4_Callback(h, eventdata, handles, varargin)% To check for Nif handles.chk == 0 N = 205;else N = handles.data; % Number of samplesendNP = handles.data1; % Noise Powerhandles.data3 = handles.data3 + 1; % to keep track of number of times push buttons are used% Generator[x,v,snr] = generator(3,N,NP);size(x);% Display SNRset(handles.edit3,'String',snr)% To plot on GUIf = 1:N;axes(handles.Out_dtmf) % Select the proper axesplot(f,x(1:N))set(handles.Out_dtmf,'XMinorTick','on')grid on% Decoder[D,m] = decoder(x,N);size(m);% To append each dialled digit into an array (max 8 numbers)[handles.data4,handles.data3] = StringNum(handles.data4,D,handles.data3);% After 8th digit the next number is put into first digit placeif handles.data4 == ' ' handles.data4(handles.data3) = D;end% To display the dialled numbers set(handles.edit2,'String',handles.data4); % The dialled number as decoded by the decoder % is displayed on the edit text% To plot the output f = 1 : length(m);axes(handles.G_output) % Select the proper axesplot(f,m)set(handles.G_output,'XMinorTick','on')grid onguidata(h,handles);% --------------------------------------------------------------------function varargout = pushbutton5_Callback(h, eventdata, handles, varargin)% To check for Nif handles.chk == 0 N = 205;else N = handles.data; % Number of samplesendNP = handles.data1; % Noise Powerhandles.data3 = handles.data3 + 1; % to keep track of number of times push buttons are used% Generator[x,v,snr] = generator(4,N,NP);size(x);% Display SNRset(handles.edit3,'String',snr)% To plot on GUIf = 1:N;axes(handles.Out_dtmf) % Select the proper axesplot(f,x(1:N))set(handles.Out_dtmf,'XMinorTick','on')grid on% Decoder[D,m] = decoder(x,N);size(m);% To append each dialled digit into an array (max 8 numbers)[handles.data4,handles.data3] = StringNum(handles.data4,D,handles.data3);% After 8th digit the next number is put into first digit placeif handles.data4 == ' ' handles.data4(handles.data3) = D;end% To display the dialled numbers set(handles.edit2,'String',handles.data4); % The dialled number as decoded by the decoder % is displayed on the edit text% To plot the output f = 1 : length(m);axes(handles.G_output) % Select the proper axesplot(f,m)set(handles.G_output,'XMinorTick','on')grid onguidata(h,handles);% --------------------------------------------------------------------function varargout = pushbutton6_Callback(h, eventdata, handles, varargin)% To check for Nif handles.chk == 0 N = 205;else N = handles.data; % Number of samplesendNP = handles.data1; % Noise Powerhandles.data3 = handles.data3 + 1; % to keep track of number of times push buttons are used% Generator[x,v,snr] = generator(5,N,NP);size(x);% Display SNRset(handles.edit3,'String',snr)% To plot on GUIf = 1:N;axes(handles.Out_dtmf) % Select the proper axesplot(f,x(1:N))set(handles.Out_dtmf,'XMinorTick','on')grid on% Decoder[D,m] = decoder(x,N);size(m);% To append each dialled digit into an array (max 8 numbers)[handles.data4,handles.data3] = StringNum(handles.data4,D,handles.data3);% After 8th digit the next number is put into first digit placeif handles.data4 == ' ' handles.data4(handles.data3) = D;end% To display the dialled numbers set(handles.edit2,'String',handles.data4); % The dialled number as decoded by the decoder % is displayed on the edit text% To plot the output f = 1 : length(m);axes(handles.G_output) % Select the proper axesplot(f,m)set(handles.G_output,'XMinorTick','on')grid onguidata(h,handles);% --------------------------------------------------------------------function varargout = pushbutton7_Callback(h, eventdata, handles, varargin)% To check for Nif handles.chk == 0 N = 205;else N = handles.data; % Number of samplesendNP = handles.data1; % Noise Powerhandles.data3 = handles.data3 + 1; % to keep track of number of times push buttons are used% Generator[x,v,snr] = generator(7,N,NP);size(x);% Display SNRset(handles.edit3,'String',snr)% To plot on GUIf = 1:N;axes(handles.Out_dtmf) % Select the proper axesplot(f,x(1:N))set(handles.Out_dtmf,'XMinorTick','on')grid on% Decoder[D,m] = decoder(x,N);size(m);% To append each dialled digit into an array (max 8 numbers)[handles.data4,handles.data3] = StringNum(handles.data4,D,handles.data3);% After 8th digit the next number is put into first digit placeif handles.data4 == ' ' handles.data4(handles.data3) = D;end% To display the dialled numbers set(handles.edit2,'String',handles.data4); % The dialled number as decoded by the decoder % is displayed on the edit text% To plot the output f = 1 : length(m);axes(handles.G_output) % Select the proper axesplot(f,m)set(handles.G_output,'XMinorTick','on')grid onguidata(h,handles);% --------------------------------------------------------------------function varargout = pushbutton8_Callback(h, eventdata, handles, varargin)% To check for Nif handles.chk == 0 N = 205;else N = handles.data; % Number of samplesendNP = handles.data1; % Noise Powerhandles.data3 = handles.data3 + 1; % to keep track of number of times push buttons are used% Generator[x,v,snr] = generator(6,N,NP);size(x);% Display SNRset(handles.edit3,'String',snr)% To plot on GUIf = 1:N;axes(handles.Out_dtmf) % Select the proper axesplot(f,x(1:N))set(handles.Out_dtmf,'XMinorTick','on')grid on% Decoder[D,m] = decoder(x,N);size(m);% To append each dialled digit into an array (max 8 numbers)[handles.data4,handles.data3] = StringNum(handles.data4,D,handles.data3);% After 8th digit the next number is put into first digit placeif handles.data4 == ' ' handles.data4(handles.data3) = D;end% To display the dialled numbers set(handles.edit2,'String',handles.data4); % The dialled number as decoded by the decoder % is displayed on the edit text% To plot the output
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -