function varargout = mil_188_gui(varargin)
% MIL_188_GUI M-file for mil_188_gui.fig
% MIL_188_GUI, by itself, creates a new MIL_188_GUI or raises the existing
% singleton*.
%
% H = MIL_188_GUI returns the handle to a new MIL_188_GUI or the handle to
% the existing singleton*.
%
% MIL_188_GUI('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in MIL_188_GUI.M with the given input arguments.
%
% MIL_188_GUI('Property','Value',...) creates a new MIL_188_GUI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before mil_188_gui_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to mil_188_gui_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help mil_188_gui
% Last Modified by GUIDE v2.5 15-Sep-2008 09:20:58
% Copywrite 2008-2010 The MathWorks, Inc.
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @mil_188_gui_OpeningFcn, ...
'gui_OutputFcn', @mil_188_gui_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before mil_188_gui is made visible.
function mil_188_gui_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to mil_188_gui (see VARARGIN)
% Choose default command line output for mil_188_gui
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes mil_188_gui wait for user response (see UIRESUME)
% uiwait(handles.main_figure);
% --- Outputs from this function are returned to the command line.
function varargout = mil_188_gui_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in Run_Button.
function Run_Button_Callback(hObject, eventdata, handles)
% hObject handle to Run_Button (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
mil_std_188_Rx_6; % open the Simulink Model
% set up to close model when this gui closes
set(handles.main_figure,'CloseRequestFcn','closereq; close_system(gcs,0)')
global data_out
% select channel impairment
Channel=get(handles.Channel_Select,'value');
ss=['mil_std_188_Rx_6/IQ_Source/Chan_Sel'];
set_param(ss,'value',num2str(Channel));
% set SNR in dB
snr_dB = get(handles.snr_edit,'string');
ss=['mil_std_188_Rx_6/IQ_Source/Freq Translator and Channel/'];
% get_param([ss,'AWGN/AWGN Channel'],'DialogParameters') % gets block
% parameters, handy for debugging.
set_param([ss,'AWGN/AWGN Channel'],'SNRdB',snr_dB)
set_param([ss,'Static Channel/AWGN Channel'],'SNRdB',snr_dB)
set_param([ss,'Fading Channel/AWGN Channel'],'SNRdB',snr_dB)
set_param('mil_std_188_Rx_6/Demodulation and Error Correction/Text_On','value','0')
h=handles.Text_Display;
% Run through 4 different wave files for input to the modem
for run=1:4
switch run
case 1
!copy mil_188_message_1.wav mil_188_waveform.wav
set(h,'String','Waiting for Modem to Receive Transmission.')
case 2
!copy mil_188_message_2.wav mil_188_waveform.wav
case 3
!copy mil_188_message_3.wav mil_188_waveform.wav
case 4
!copy mil_188_message_4.wav mil_188_waveform.wav
end
sim('mil_std_188_Rx_6');
% find leading zeros in the data.
k=1;
while data_out(k)==0
k=k+1;
end;
% send characters to text box
set(h,'String',{char(data_out(k:end)')});
end
% --- Executes on selection change in Channel_Select.
function Channel_Select_Callback(hObject, eventdata, handles)
% hObject handle to Channel_Select (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns Channel_Select contents as cell array
% contents{get(hObject,'Value')} returns selected item from Channel_Select
function snr_edit_Callback(hObject, eventdata, handles)
% hObject handle to snr_edit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of snr_edit as text
% str2double(get(hObject,'String')) returns contents of snr_edit as a double
% --- Executes during object creation, after setting all properties.
function snr_edit_CreateFcn(hObject, eventdata, handles)
% hObject handle to snr_edit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end