function varargout = dattorrogui(varargin)
% DATTORROGUI M-file for dattorrogui.fig
%      DATTORROGUI, by itself, creates a new DATTORROGUI or raises the existing
%      singleton*.
%
%      H = DATTORROGUI returns the handle to a new DATTORROGUI or the handle to
%      the existing singleton*.
%
%      DATTORROGUI('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in DATTORROGUI.M with the given input arguments.
%
%      DATTORROGUI('Property','Value',...) creates a new DATTORROGUI or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before dattorrogui_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to dattorrogui_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 dattorrogui

% Last Modified by GUIDE v2.5 22-May-2014 23:01:12

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @dattorrogui_OpeningFcn, ...
                   'gui_OutputFcn',  @dattorrogui_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 dattorrogui is made visible.
function dattorrogui_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 dattorrogui (see VARARGIN)

% Choose default command line output for dattorrogui
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes dattorrogui wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = dattorrogui_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;



function bandwidth_Callback(hObject, eventdata, handles)
% hObject    handle to bandwidth (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 bandwidth as text
%        str2double(get(hObject,'String')) returns contents of bandwidth as a double


% --- Executes during object creation, after setting all properties.
function bandwidth_CreateFcn(hObject, eventdata, handles)
% hObject    handle to bandwidth (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



function inputdiffusion2_Callback(hObject, eventdata, handles)
% hObject    handle to inputdiffusion2 (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 inputdiffusion2 as text
%        str2double(get(hObject,'String')) returns contents of inputdiffusion2 as a double


% --- Executes during object creation, after setting all properties.
function inputdiffusion2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to inputdiffusion2 (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



function decaydiffusion2_Callback(hObject, eventdata, handles)
% hObject    handle to decaydiffusion2 (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 decaydiffusion2 as text
%        str2double(get(hObject,'String')) returns contents of decaydiffusion2 as a double


% --- Executes during object creation, after setting all properties.
function decaydiffusion2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to decaydiffusion2 (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



function inputdiffusion1_Callback(hObject, eventdata, handles)
% hObject    handle to inputdiffusion1 (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 inputdiffusion1 as text
%        str2double(get(hObject,'String')) returns contents of inputdiffusion1 as a double


% --- Executes during object creation, after setting all properties.
function inputdiffusion1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to inputdiffusion1 (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



function decaydiffusion1_Callback(hObject, eventdata, handles)
% hObject    handle to decaydiffusion1 (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 decaydiffusion1 as text
%        str2double(get(hObject,'String')) returns contents of decaydiffusion1 as a double


% --- Executes during object creation, after setting all properties.
function decaydiffusion1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to decaydiffusion1 (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



function decay_Callback(hObject, eventdata, handles)
% hObject    handle to decay (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 decay as text
%        str2double(get(hObject,'String')) returns contents of decay as a double


% --- Executes during object creation, after setting all properties.
function decay_CreateFcn(hObject, eventdata, handles)
% hObject    handle to decay (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



function delay6_Callback(hObject, eventdata, handles)
% hObject    handle to delay6 (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 delay6 as text
%        str2double(get(hObject,'String')) returns contents of delay6 as a double


% --- Executes during object creation, after setting all properties.
function delay6_CreateFcn(hObject, eventdata, handles)
% hObject    handle to delay6 (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



function delay8_Callback(hObject, eventdata, handles)
% hObject    handle to delay8 (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 delay8 as text
%        str2double(get(hObject,'String')) returns contents of delay8 as a double


% --- Executes during object creation, after setting all properties.
function delay8_CreateFcn(hObject, eventdata, handles)
% hObject    handle to delay8 (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



function delay66_Callback(hObject, eventdata, handles)
% hObject    handle to delay66 (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 delay66 as text
%        str2double(get(hObject,'String')) returns contents of delay66 as a double


% --- Executes during object creation, after setting all properties.
function delay66_CreateFcn(hObject, eventdata, handles)
% hObject    handle to delay66 (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



function delay88_Callback(hObject, eventdata, handles)
% hObject    handle to delay88 (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 delay88 as text
%        str2double(get(hObject,'String')) returns contents of delay88 as a double


% --- Executes during object creation, after setting all properties.
function delay88_CreateFcn(hObject, eventdata, handles)
% hObject    handle to delay88 (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



function delay1_Callback(hObject, eventdata, handles)
% hObject    handle to delay1 (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 delay1 as text
%        str2double(get(hObject,'String')) returns contents of delay1 as a double


% --- Executes during object creation, after setting all properties.
function delay1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to delay1 (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



function delay2_Callback(hObject, eventdata, handles)
% hObject    handle to delay2 (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 delay2 as text
%        str2double(get(hObject,'String')) returns contents of delay2 as a double


% --- Executes during object creation, after setting all properties.
function delay2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to delay2 (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



function delay3_Callback(hObject, eventdata, handles)
% hObject    handle to delay3 (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 delay3 as text
%        str2double(get(hObject,'String')) returns contents of delay3 as a double


% --- Executes during object creation, after setting all properties.
function delay3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to delay3 (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



function delay4_Callback(hObject, eventdata, handles)
% hObject    handle to delay4 (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 delay4 as text
%        str2double(get(hObject,'String')) returns contents of delay4 as a double


% --- Executes during object creation, after setting all properties.
function delay4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to delay4 (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



function delay5_Callback(hObject, eventdata, handles)
% hObject    handle to delay5 (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 delay5 as text
%        str2double(get(hObject,'String')) returns contents of delay5 as a double


% --- Executes during object creation, after setting all properties.
function delay5_CreateFcn(hObject, eventdata, handles)
% hObject    handle to delay5 (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



function delay7_Callback(hObject, eventdata, handles)
% hObject    handle to delay7 (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 delay7 as text
%        str2double(get(hObject,'String')) returns contents of delay7 as a double


% --- Executes during object creation, after setting all properties.
function delay7_CreateFcn(hObject, eventdata, handles)
% hObject    handle to delay7 (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



function delay55_Callback(hObject, eventdata, handles)
% hObject    handle to delay55 (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 delay55 as text
%        str2double(get(hObject,'String')) returns contents of delay55 as a double


% --- Executes during object creation, after setting all properties.
function delay55_CreateFcn(hObject, eventdata, handles)
% hObject    handle to delay55 (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



function delay77_Callback(hObject, eventdata, handles)
% hObject    handle to delay77 (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 delay77 as text
%        str2double(get(hObject,'String')) returns contents of delay77 as a double


% --- Executes during object creation, after setting all properties.
function delay77_CreateFcn(hObject, eventdata, handles)
% hObject    handle to delay77 (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



function RT_Callback(hObject, eventdata, handles)
% hObject    handle to RT (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 RT as text
%        str2double(get(hObject,'String')) returns contents of RT as a double


% --- Executes during object creation, after setting all properties.
function RT_CreateFcn(hObject, eventdata, handles)
% hObject    handle to RT (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



function EDT_Callback(hObject, eventdata, handles)
% hObject    handle to EDT (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 EDT as text
%        str2double(get(hObject,'String')) returns contents of EDT as a double


% --- Executes during object creation, after setting all properties.
function EDT_CreateFcn(hObject, eventdata, handles)
% hObject    handle to EDT (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



function HFR_Callback(hObject, eventdata, handles)
% hObject    handle to HFR (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 HFR as text
%        str2double(get(hObject,'String')) returns contents of HFR as a double


% --- Executes during object creation, after setting all properties.
function HFR_CreateFcn(hObject, eventdata, handles)
% hObject    handle to HFR (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



function C7_Callback(hObject, eventdata, handles)
% hObject    handle to C7 (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 C7 as text
%        str2double(get(hObject,'String')) returns contents of C7 as a double


% --- Executes during object creation, after setting all properties.
function C7_CreateFcn(hObject, eventdata, handles)
% hObject    handle to C7 (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



function C80_Callback(hObject, eventdata, handles)
% hObject    handle to C80 (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 C80 as text
%        str2double(get(hObject,'String')) returns contents of C80 as a double


% --- Executes during object creation, after setting all properties.
function C80_CreateFcn(hObject, eventdata, handles)
% hObject    handle to C80 (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



function D50_Callback(hObject, eventdata, handles)
% hObject    handle to D50 (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 D50 as text
%        str2double(get(hObject,'String')) returns contents of D50 as a double


% --- Executes during object creation, after setting all properties.
function D50_CreateFcn(hObject, eventdata, handles)
% hObject    handle to D50 (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



function H_Callback(hObject, eventdata, handles)
% hObject    handle to H (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 H as text
%        str2double(get(hObject,'String')) returns contents of H as a double


% --- Executes during object creation, after setting all properties.
function H_CreateFcn(hObject, eventdata, handles)
% hObject    handle to H (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



function BR_Callback(hObject, eventdata, handles)
% hObject    handle to BR (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 BR as text
%        str2double(get(hObject,'String')) returns contents of BR as a double


% --- Executes during object creation, after setting all properties.
function BR_CreateFcn(hObject, eventdata, handles)
% hObject    handle to BR (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



function ITDG_Callback(hObject, eventdata, handles)
% hObject    handle to ITDG (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 ITDG as text
%        str2double(get(hObject,'String')) returns contents of ITDG as a double


% --- Executes during object creation, after setting all properties.
function ITDG_CreateFcn(hObject, eventdata, handles)
% hObject    handle to ITDG (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



function IACCE_Callback(hObject, eventdata, handles)
% hObject    handle to IACCE (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 IACCE as text
%        str2double(get(hObject,'String')) returns contents of IACCE as a double


% --- Executes during object creation, after setting all properties.
function IACCE_CreateFcn(hObject, eventdata, handles)
% hObject    handle to IACCE (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



function EK_Callback(hObject, eventdata, handles)
% hObject    handle to EK (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 EK as text
%        str2double(get(hObject,'String')) returns contents of EK as a double


% --- Executes during object creation, after setting all properties.
function EK_CreateFcn(hObject, eventdata, handles)
% hObject    handle to EK (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



function C50_Callback(hObject, eventdata, handles)
% hObject    handle to C50 (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 C50 as text
%        str2double(get(hObject,'String')) returns contents of C50 as a double


% --- Executes during object creation, after setting all properties.
function C50_CreateFcn(hObject, eventdata, handles)
% hObject    handle to C50 (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



function ts_Callback(hObject, eventdata, handles)
% hObject    handle to ts (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 ts as text
%        str2double(get(hObject,'String')) returns contents of ts as a double


% --- Executes during object creation, after setting all properties.
function ts_CreateFcn(hObject, eventdata, handles)
% hObject    handle to ts (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


% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
x=handles.x;
p=handles.p;
sound(x,p)



% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
y=handles.y;
p=handles.p;
sound(y,p)



% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
clc

%nacitanie x, prepisanie info riadku
x=handles.x;
set(handles.info,'String','Počíta sa impulzná odozva');
drawnow;

%jednotkovy impulz na vytvorenie impulznej odozvy
implength=str2double(get(handles.implength,'String'));
Fvz=str2double(get(handles.Fvz,'String'));
wet=str2double(get(handles.drywet,'String'));
bandwidth=str2double(get(handles.bandwidth,'String'));
damping=str2double(get(handles.damping,'String'));
decay=str2double(get(handles.decay,'String'));
inputdiffusion1=str2double(get(handles.inputdiffusion1,'String'));
inputdiffusion2=str2double(get(handles.inputdiffusion2,'String'));
decaydiffusion1=str2double(get(handles.decaydiffusion1,'String'));
decaydiffusion2=str2double(get(handles.decaydiffusion2,'String'));

%vypocet medzneho kmitoctu dolnych priepustnosti
fc=bandwidth/Fvz;
bandwidth=2-cos(2*pi*fc)-sqrt(((cos(2*pi*fc)-2)^2)-1);
fc=damping/Fvz;
damping=2-cos(2*pi*fc)-sqrt(((cos(2*pi*fc)-2)^2)-1);

%ulozenie fvz na pouzitie v inom callbacku
handles.p=Fvz;

%impulzna odozva vo vzorkoch
implength=implength*Fvz;

%jednotkovy impulz na vytvorenie impulznej odozvy, pripraveny na filtroanie
xmono=1;
xmono(implength)=0;

%oneskorenia jednotlivych prvkov 
delay1 =str2double(get(handles.delay1,'String'));
delay2 =str2double(get(handles.delay2,'String'));
delay3 =str2double(get(handles.delay3,'String'));
delay4 =str2double(get(handles.delay4,'String'));
delay5 =str2double(get(handles.delay5,'String'));
delay6 =str2double(get(handles.delay6,'String'));
delay7 =str2double(get(handles.delay7,'String'));
delay8 =str2double(get(handles.delay8,'String'));
delay55 =str2double(get(handles.delay55,'String'));
delay66 =str2double(get(handles.delay66,'String'));
delay77 =str2double(get(handles.delay77,'String'));
delay88 =str2double(get(handles.delay88,'String'));

%oneskorenia v output tapoch tanku pre lavy a pravy kanal
leftdelay1 = 394;
leftdelay2 = 4407;
leftdelay3 = 2834;
leftdelay4 = 2957;
leftdelay5 = 2949;
leftdelay6 = 277;
leftdelay7 = 1580;

rightdelay1 = 523;
rightdelay2 = 5375;
rightdelay3 = 1820;
rightdelay4 = 3961;
rightdelay5 = 3128;
rightdelay6 = 496;
rightdelay7 = 179;

%% definicia prvkov

%lowpass

b=[1-bandwidth 0];
a=[1 -bandwidth];

LP1=tf(b,a);

%allpass1
k=delay1;

b=zeros(1,k+1);
a=zeros(1,k+1);
b(1)=inputdiffusion1;
b(k+1)=1;
a(1)=1;
a(k+1)=inputdiffusion1;

AP1=tf(b,a);  

%allpass2
k=delay2;

b=zeros(1,k+1);
a=zeros(1,k+1);
b(1)=inputdiffusion1;
b(k+1)=1;
a(1)=1;
a(k+1)=inputdiffusion1;

AP2=tf(b,a);

%allpass3
k=delay3;

b=zeros(1,k+1);
a=zeros(1,k+1);
b(1)=inputdiffusion2;
b(k+1)=1;
a(1)=1;
a(k+1)=inputdiffusion2;

AP3=tf(b,a);

%allpass4
k=delay4;

b=zeros(1,k+1);
a=zeros(1,k+1);
b(1)=inputdiffusion2;
b(k+1)=1;
a(1)=1;
a(k+1)=inputdiffusion2;

AP4=tf(b,a);

%tank vetva 1

%allpass5
k=delay5;

b=zeros(1,k+1);
a=zeros(1,k+1);
b(1)=decaydiffusion1;
b(k+1)=1;
a(1)=1;
a(k+1)=decaydiffusion1;

AP5=tf(b,a);

%delay
k=delay6;

b=zeros(1,k+1);
b(k+1)=1;
a=1;

D1=tf(b,a);

%lowpass

b=[1-damping 0];
a=[1 -damping];

LP2=tf(b,a);

%allpass6
k=delay7;

b=zeros(1,k+1);
a=zeros(1,k+1);
b(1)=decaydiffusion2;
b(k+1)=1;
a(1)=1;
a(k+1)=decaydiffusion2;

AP6=tf(b,a);

%delay
k=delay8;

b=zeros(1,k+1);
b(k+1)=1;
a=1;

D2=tf(b,a);

%tank vetva 2

%allpass55
k=delay55;

b=zeros(1,k+1);
a=zeros(1,k+1);
b(1)=decaydiffusion1;
b(k+1)=1;
a(1)=1;
a(k+1)=decaydiffusion1;

AP55=tf(b,a);

%delay
k=delay66;

b=zeros(1,k+1);
b(k+1)=1;
a=1;

D11=tf(b,a);

%lowpass

b=[1-damping 0];
a=[1 -damping];

LP22=tf(b,a);

%allpass66
k=delay77;

b=zeros(1,k+1);
a=zeros(1,k+1);
b(1)=decaydiffusion2;
b(k+1)=1;
a(1)=1;
a(k+1)=decaydiffusion2;

AP66=tf(b,a);

%delay
k=delay88;

b=zeros(1,k+1);
b(k+1)=1;
a=1;

D22=tf(b,a);

%% prenosove funcie kombinacii prvkov

%dekorelacna faza
first=LP1*AP1*AP2*AP3*AP4;
[b1,a1]=tfdata(first,'v');

%prenosova funkcia tanku
tank1=AP5*D1*LP2*decay*AP6*D2*decay;
tank2=AP55*D11*LP22*decay*AP66*D22*decay;

tank=(1+tank2)/(1-tank1*tank2);
[b2,a2]=tfdata(tank,'v');
%% reverberacia

%dekorelacia signalu a ziskanie referencneho signalu v tanku 
beforetank=filter(b1,a1,xmono);
tank_ref=filter(b2,a2,beforetank);

%ziskavanie oneskorenych vystupnych signalov z roznych bodov tanku
%vytvaranie impulznej odozvy
[node1] = allpass(tank_ref, delay5,-decaydiffusion1);
[leftchannel] = delay(-node1, leftdelay5);
[rightchannel] = delay(node1, rightdelay1);
[rightbuffer] = delay(node1, rightdelay2);
rightchannel = vektorplus(rightchannel, rightbuffer);

[node2] = delay(node1, delay6);

[node3] = lowpass(decay*node2, damping);
[leftbuffer] = allpasszasobnik(node3, delay7,decaydiffusion2, leftdelay6);
leftchannel = vektorplus(leftchannel, leftbuffer);
[rightbuffer] = allpasszasobnik(node3, delay7, decaydiffusion2, rightdelay3);
rightchannel = vektorplus(rightchannel, rightbuffer);

[node4] = allpass(node3, delay7, decaydiffusion2);
[leftbuffer] = delay(-node4, leftdelay7);
leftchannel = vektorplus(leftchannel, leftbuffer);
[rightbuffer] = delay(node4, rightdelay4);
rightchannel = vektorplus(rightchannel, rightbuffer);

[node5] = delay(node4, delay8);

[node6] = allpass((beforetank+decay*node5), delay55, -decaydiffusion1);

[leftbuffer] = delay(node6, leftdelay1);
leftchannel = vektorplus(leftchannel, leftbuffer);
[leftbuffer] = delay(node6, leftdelay2);
leftchannel = vektorplus(leftchannel, leftbuffer);
[rightbuffer] = delay(-node6, rightdelay5);
rightchannel = vektorplus(rightchannel, rightbuffer);

[node7] = delay(node6, delay66);

[node8] = lowpass(decay*node7, damping);
[leftbuffer] =  allpasszasobnik(node8, delay77, decaydiffusion2, leftdelay3);
leftchannel = vektorplus(leftchannel, leftbuffer);
[rightbuffer] = allpasszasobnik(node8, delay77, decaydiffusion2, rightdelay6);
rightchannel = vektorplus(rightchannel, rightbuffer);

[node9] = allpass(node8, delay88, decaydiffusion2);
[leftbuffer] = delay(node9, leftdelay4);
leftchannel = vektorplus(leftchannel, leftbuffer);
[rightbuffer] = delay(-node9, rightdelay7);
rightchannel = vektorplus(rightchannel, rightbuffer);

%vytvorenie stereo impulznej odozvy
IR(:,1)=leftchannel;
IR(:,2)=rightchannel;

% filtrovanie vstupneho signalu
if size(x,2)==2
    xl=x(:,1);
    xr=x(:,2);
    
    [xl,leftchannel]=eqtflength(xl,leftchannel);
    [xr,rightchannel]=eqtflength(xr,rightchannel);
    
    y(:,1)=conv(xl, leftchannel);
    y(:,2)=conv(xr, rightchannel);
    
    %dry wet
    y(:,1)=vektorplus(wet*y(:,1),((1-wet)*xl)');
    y(:,2)=vektorplus(wet*y(:,2),((1-wet)*xr)');
    
elseif size(x,2)==1
     [x,leftchannel]=eqtflength(x,leftchannel);
     y(1,:)=conv(x,leftchannel);
     [x,rightchannel]=eqtflength(x,rightchannel);
     y(2,:)=conv(x,rightchannel);
     
     %dry wet
     yleft=vektorplus(wet*y(1,:),(1-wet)*x);
     yright=vektorplus(wet*y(2,:),(1-wet)*x);
     
     clear y;
     
     y(:,1)=yleft';
     y(:,2)=yright';    
     
end

%%odstranenie nul z konca vystupneho signalu
I=find(abs(y(:,1))>10^(-5),1,'last');
y=y(1:I,:);

%%odstranenie nul z konca impulznej odozvy
I=find(abs(IR(:,1))>10^(-5),1,'last');
IR=IR(1:I,:);

handles.y=y;
%% vykreslenie impluznej odozvy
n=(1:length(IR));

plot(handles.impz,n/Fvz,IR);
h=title(handles.impz,'\bfImpulzná charakteristika reverberátoru');
xlabel(handles.impz,'{{\itt}} (s) \rightarrow')
ylabel(handles.impz,'\ith(-) \rightarrow')

%% spektra vstupneho a vystupneho signalu + reverberatoru

Nd=length(IR);
I=fft(IR)/Nd;                                        %výpočet DFT signálu y o délce Nd pomocí FFT, výsledek dělen Nd
I=I(1:(length(I)/2));
n=(1:length(I));
plot(handles.freqz,n/Nd*Fvz,abs(I));
h=title(handles.freqz,'\bf Kmitočtová charakteristika reverberátoru');

xlabel(handles.freqz,'{{\itf}} (Hz) \rightarrow')
ylabel(handles.freqz,'Modul (-) \rightarrow')
set(handles.freqz,'xlim',[20 20000])

%% vstupny signal
n=(1:length(x));

plot(handles.input,n/Fvz,x);
h=title(handles.input,'\bfVstupný signál');
xlabel(handles.input,'{{\itt}} (s) \rightarrow')
ylabel(handles.input,'\its(-) \rightarrow')

%% vystupny signal
n=(1:length(y));

plot(n/Fvz,y)
h=title('\bfVýstupny signál');
xlabel('{{\itt}} (s) \rightarrow')
ylabel('\its(-) \rightarrow')

[RT,EDT,C7,C50,C80,D50,H,itdg,BR,HFR,Ts,IACCE,EKdelta] = objective(IR,Fvz)
D50=D50*100;
EK=max(EKdelta);

set(handles.RT,'String',num2str(RT,3));
set(handles.EDT,'String',num2str(EDT,3));
set(handles.BR,'String',num2str(BR,3));
set(handles.HFR,'String',num2str(HFR,3));
set(handles.C7,'String',num2str(C7,3));
set(handles.C50,'String',num2str(C50,3));
set(handles.C80,'String',num2str(C80,3));
set(handles.H,'String',num2str(H,3));
set(handles.ts,'String',num2str(Ts,3));
set(handles.D50,'String',num2str(D50,3));
set(handles.ITDG,'String',num2str(itdg,3));
set(handles.EK,'String',num2str(EK,3));
set(handles.IACCE,'String',num2str(IACCE,3));


set(handles.info,'String','Impulzná odozva vypočítaná');
guidata(hObject, handles);

function implength_Callback(hObject, eventdata, handles)
% hObject    handle to implength (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 implength as text
%        str2double(get(hObject,'String')) returns contents of implength as a double


% --- Executes during object creation, after setting all properties.
function implength_CreateFcn(hObject, eventdata, handles)
% hObject    handle to implength (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



function drywet_Callback(hObject, eventdata, handles)
% hObject    handle to drywet (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 drywet as text
%        str2double(get(hObject,'String')) returns contents of drywet as a double


% --- Executes during object creation, after setting all properties.
function drywet_CreateFcn(hObject, eventdata, handles)
% hObject    handle to drywet (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



function Fvz_Callback(hObject, eventdata, handles)
% hObject    handle to Fvz (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 Fvz as text
%        str2double(get(hObject,'String')) returns contents of Fvz as a double


% --- Executes during object creation, after setting all properties.
function Fvz_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Fvz (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



function damping_Callback(hObject, eventdata, handles)
% hObject    handle to gffh (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 gffh as text
%        str2double(get(hObject,'String')) returns contents of gffh as a double


% --- Executes during object creation, after setting all properties.
function gffh_CreateFcn(hObject, eventdata, handles)
% hObject    handle to gffh (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


% --- Executes during object creation, after setting all properties.
function damping_CreateFcn(hObject, eventdata, handles)
% hObject    handle to damping (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


% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[filename pathname]=uigetfile({'*.wav'},'Vyber súbor na reverberáciu');
fullpathname=strcat(pathname, filename)

x=wavread(fullpathname);

handles.x=x;

set(handles.info,'String','Súbor načítaný');

guidata(hObject, handles);

