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

% Last Modified by GUIDE v2.5 23-May-2014 21:43:15

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

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

% Update handles structure
guidata(hObject, handles);

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

% --- Outputs from this function are returned to the command line.
function varargout = vanaanengui_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 k1_Callback(hObject, eventdata, handles)
% hObject    handle to k1 (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 k1 as text
%        str2double(get(hObject,'String')) returns contents of k1 as a double


% --- Executes during object creation, after setting all properties.
function k1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to k1 (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 k2_Callback(hObject, eventdata, handles)
% hObject    handle to k2 (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 k2 as text
%        str2double(get(hObject,'String')) returns contents of k2 as a double


% --- Executes during object creation, after setting all properties.
function k2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to k2 (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 k3_Callback(hObject, eventdata, handles)
% hObject    handle to k3 (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 k3 as text
%        str2double(get(hObject,'String')) returns contents of k3 as a double


% --- Executes during object creation, after setting all properties.
function k3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to k3 (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 k33_Callback(hObject, eventdata, handles)
% hObject    handle to k33 (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 k33 as text
%        str2double(get(hObject,'String')) returns contents of k33 as a double


% --- Executes during object creation, after setting all properties.
function k33_CreateFcn(hObject, eventdata, handles)
% hObject    handle to k33 (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 k44_Callback(hObject, eventdata, handles)
% hObject    handle to k44 (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 k44 as text
%        str2double(get(hObject,'String')) returns contents of k44 as a double


% --- Executes during object creation, after setting all properties.
function k44_CreateFcn(hObject, eventdata, handles)
% hObject    handle to k44 (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 k4_Callback(hObject, eventdata, handles)
% hObject    handle to k4 (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 k4 as text
%        str2double(get(hObject,'String')) returns contents of k4 as a double


% --- Executes during object creation, after setting all properties.
function k4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to k4 (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 k11_Callback(hObject, eventdata, handles)
% hObject    handle to k11 (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 k11 as text
%        str2double(get(hObject,'String')) returns contents of k11 as a double


% --- Executes during object creation, after setting all properties.
function k11_CreateFcn(hObject, eventdata, handles)
% hObject    handle to k11 (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 k22_Callback(hObject, eventdata, handles)
% hObject    handle to k22 (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 k22 as text
%        str2double(get(hObject,'String')) returns contents of k22 as a double


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



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


% --- Executes during object creation, after setting all properties.
function kl4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to kl4 (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 kl5_Callback(hObject, eventdata, handles)
% hObject    handle to kl5 (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 kl5 as text
%        str2double(get(hObject,'String')) returns contents of kl5 as a double


% --- Executes during object creation, after setting all properties.
function kl5_CreateFcn(hObject, eventdata, handles)
% hObject    handle to kl5 (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 kl6_Callback(hObject, eventdata, handles)
% hObject    handle to kl6 (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 kl6 as text
%        str2double(get(hObject,'String')) returns contents of kl6 as a double


% --- Executes during object creation, after setting all properties.
function kl6_CreateFcn(hObject, eventdata, handles)
% hObject    handle to kl6 (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 kl7_Callback(hObject, eventdata, handles)
% hObject    handle to kl7 (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 kl7 as text
%        str2double(get(hObject,'String')) returns contents of kl7 as a double


% --- Executes during object creation, after setting all properties.
function kl7_CreateFcn(hObject, eventdata, handles)
% hObject    handle to kl7 (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 kl8_Callback(hObject, eventdata, handles)
% hObject    handle to kl8 (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 kl8 as text
%        str2double(get(hObject,'String')) returns contents of kl8 as a double


% --- Executes during object creation, after setting all properties.
function kl8_CreateFcn(hObject, eventdata, handles)
% hObject    handle to kl8 (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 gl4_Callback(hObject, eventdata, handles)
% hObject    handle to gl4 (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 gl4 as text
%        str2double(get(hObject,'String')) returns contents of gl4 as a double


% --- Executes during object creation, after setting all properties.
function gl4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to gl4 (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 gl5_Callback(hObject, eventdata, handles)
% hObject    handle to gl5 (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 gl5 as text
%        str2double(get(hObject,'String')) returns contents of gl5 as a double


% --- Executes during object creation, after setting all properties.
function gl5_CreateFcn(hObject, eventdata, handles)
% hObject    handle to gl5 (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 gl6_Callback(hObject, eventdata, handles)
% hObject    handle to gl6 (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 gl6 as text
%        str2double(get(hObject,'String')) returns contents of gl6 as a double


% --- Executes during object creation, after setting all properties.
function gl6_CreateFcn(hObject, eventdata, handles)
% hObject    handle to gl6 (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 gl7_Callback(hObject, eventdata, handles)
% hObject    handle to gl7 (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 gl7 as text
%        str2double(get(hObject,'String')) returns contents of gl7 as a double


% --- Executes during object creation, after setting all properties.
function gl7_CreateFcn(hObject, eventdata, handles)
% hObject    handle to gl7 (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 gl8_Callback(hObject, eventdata, handles)
% hObject    handle to gl8 (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 gl8 as text
%        str2double(get(hObject,'String')) returns contents of gl8 as a double


% --- Executes during object creation, after setting all properties.
function gl8_CreateFcn(hObject, eventdata, handles)
% hObject    handle to gl8 (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 kr4_Callback(hObject, eventdata, handles)
% hObject    handle to kr4 (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 kr4 as text
%        str2double(get(hObject,'String')) returns contents of kr4 as a double


% --- Executes during object creation, after setting all properties.
function kr4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to kr4 (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 kr5_Callback(hObject, eventdata, handles)
% hObject    handle to kr5 (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 kr5 as text
%        str2double(get(hObject,'String')) returns contents of kr5 as a double


% --- Executes during object creation, after setting all properties.
function kr5_CreateFcn(hObject, eventdata, handles)
% hObject    handle to kr5 (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 kr6_Callback(hObject, eventdata, handles)
% hObject    handle to kr6 (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 kr6 as text
%        str2double(get(hObject,'String')) returns contents of kr6 as a double


% --- Executes during object creation, after setting all properties.
function kr6_CreateFcn(hObject, eventdata, handles)
% hObject    handle to kr6 (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 kr7_Callback(hObject, eventdata, handles)
% hObject    handle to kr7 (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 kr7 as text
%        str2double(get(hObject,'String')) returns contents of kr7 as a double


% --- Executes during object creation, after setting all properties.
function kr7_CreateFcn(hObject, eventdata, handles)
% hObject    handle to kr7 (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 kr8_Callback(hObject, eventdata, handles)
% hObject    handle to kr8 (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 kr8 as text
%        str2double(get(hObject,'String')) returns contents of kr8 as a double


% --- Executes during object creation, after setting all properties.
function kr8_CreateFcn(hObject, eventdata, handles)
% hObject    handle to kr8 (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 gr4_Callback(hObject, eventdata, handles)
% hObject    handle to gr4 (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 gr4 as text
%        str2double(get(hObject,'String')) returns contents of gr4 as a double


% --- Executes during object creation, after setting all properties.
function gr4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to gr4 (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 gr5_Callback(hObject, eventdata, handles)
% hObject    handle to gr5 (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 gr5 as text
%        str2double(get(hObject,'String')) returns contents of gr5 as a double


% --- Executes during object creation, after setting all properties.
function gr5_CreateFcn(hObject, eventdata, handles)
% hObject    handle to gr5 (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 gr6_Callback(hObject, eventdata, handles)
% hObject    handle to gr6 (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 gr6 as text
%        str2double(get(hObject,'String')) returns contents of gr6 as a double


% --- Executes during object creation, after setting all properties.
function gr6_CreateFcn(hObject, eventdata, handles)
% hObject    handle to gr6 (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 gr7_Callback(hObject, eventdata, handles)
% hObject    handle to gr7 (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 gr7 as text
%        str2double(get(hObject,'String')) returns contents of gr7 as a double


% --- Executes during object creation, after setting all properties.
function gr7_CreateFcn(hObject, eventdata, handles)
% hObject    handle to gr7 (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 gr8_Callback(hObject, eventdata, handles)
% hObject    handle to gr8 (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 gr8 as text
%        str2double(get(hObject,'String')) returns contents of gr8 as a double


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

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

k1=str2double(get(handles.k1,'String'));
k2=str2double(get(handles.k2,'String'));
k3=str2double(get(handles.k3,'String'));
k4=str2double(get(handles.k4,'String'));

k11=str2double(get(handles.k11,'String'));
k22=str2double(get(handles.k22,'String'));
k33=str2double(get(handles.k33,'String'));
k44=str2double(get(handles.k44,'String'));

ga1=str2double(get(handles.ga1,'String'));
ga2=str2double(get(handles.ga2,'String'));
ga3=str2double(get(handles.ga3,'String'));
ga4=str2double(get(handles.ga4,'String'));

implength=str2double(get(handles.implength,'String'));
Fvz=str2double(get(handles.Fvz,'String'));
wet=str2double(get(handles.drywet,'String'));
beta=str2double(get(handles.beta,'String'));
handles.p=Fvz;

kl1=str2double(get(handles.kl1,'String'));
kl2=str2double(get(handles.kl2,'String'));
kl3=str2double(get(handles.kl3,'String'));
kl4=str2double(get(handles.kl4,'String'));
kl5=str2double(get(handles.kl5,'String'));
kl6=str2double(get(handles.kl6,'String'));
kl7=str2double(get(handles.kl7,'String'));
kl8=str2double(get(handles.kl8,'String'));

kr1=str2double(get(handles.kr1,'String'));
kr2=str2double(get(handles.kr2,'String'));
kr3=str2double(get(handles.kr3,'String'));
kr4=str2double(get(handles.kr4,'String'));
kr5=str2double(get(handles.kr5,'String'));
kr6=str2double(get(handles.kr6,'String'));
kr7=str2double(get(handles.kr7,'String'));
kr8=str2double(get(handles.kr8,'String'));

gl1=str2double(get(handles.gl1,'String'));
gl2=str2double(get(handles.gl2,'String'));
gl3=str2double(get(handles.gl3,'String'));
gl4=str2double(get(handles.gl4,'String'));
gl5=str2double(get(handles.gl5,'String'));
gl6=str2double(get(handles.gl6,'String'));
gl7=str2double(get(handles.gl7,'String'));
gl8=str2double(get(handles.gl8,'String'));

gr1=str2double(get(handles.gr1,'String'));
gr2=str2double(get(handles.gr2,'String'));
gr3=str2double(get(handles.gr3,'String'));
gr4=str2double(get(handles.gr4,'String'));
gr5=str2double(get(handles.gr5,'String'));
gr6=str2double(get(handles.gr6,'String'));
gr7=str2double(get(handles.gr7,'String'));
gr8=str2double(get(handles.gr8,'String'));

implength=implength*Fvz;
%% prvotne odrazy
menovatel=1;
bleft(kl1)=gl1;               
bleft(kl2)=gl2;
bleft(kl3)=gl3;
bleft(kl4)=gl4;
bleft(kl5)=gl5;
bleft(kl6)=gl6;
bleft(kl7)=gl7;
bleft(kl8)=gl8;

bright(kr1)=gr1;               
bright(kr2)=gr2;
bright(kr3)=gr3;
bright(kr4)=gr4;
bright(kr5)=gr5;
bright(kr6)=gr6;
bright(kr7)=gr7;
bright(kr8)=gr8;

%impulzna odozva
FIR_left=impz(bleft,menovatel);
FIR_right=impz(bright,menovatel);
FIR_left(implength)=0;
FIR_right(implength)=0;
%% definicia prvkov modulu neskorej reverberacie

%%delay1

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

b(k1+1)=1;
a(1)=1;

D1=tf(b,a);

%%delay2

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

b(k2+1)=1;
a(1)=1;

D2=tf(b,a);

%%delay3

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

b(k3+1)=1;
a(1)=1;

D3=tf(b,a);

%%delay4

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

b(k4+1)=1;
a(1)=1;

D4=tf(b,a);

%%lowpass filtre

%%lowpass1
k=0.34;
g=0.74;                           
b=[0 (g-(g*k))];
a=[1 -k];

LP1=tf(b,a);

%%lowpass2
k=0.45;
g=0.66;                           
b=[0 (g-(g*k))];
a=[1 -k];


LP2=tf(b,a);

%%lowpass3
k=0.48;
g=0.64;                           
b=[0 (g-(g*k))];
a=[1 -k];

LP3=tf(b,a);

%%lowpass4
k=0.49;
g=0.63;                           
b=[0 (g-(g*k))];
a=[1 -k];

LP4=tf(b,a);

%%allpass filtre

%%alpass1
      
b=zeros(1,k11+1);
a=zeros(1,k11+1);
b(1)=ga1;
b(k11+1)=1;
a(1)=1;
a(k11+1)=ga1;

AP1=tf(b,a);

%%alpass2
      
b=zeros(1,k22+1);
a=zeros(1,k22+1);
b(1)=ga2;
b(k22+1)=1;
a(1)=1;
a(k22+1)=ga2;

AP2=tf(b,a);

%%alpass3
      
b=zeros(1,k33+1);
a=zeros(1,k33+1);
b(1)=ga3;
b(k33+1)=1;
a(1)=1;
a(k33+1)=ga3;

AP3=tf(b,a);

%%alpass4
      
b=zeros(1,k44+1);
a=zeros(1,k44+1);
b(1)=ga4;
b(k44+1)=1;
a(1)=1;
a(k44+1)=ga4;

AP4=tf(b,a);

%%delay jednotlivých liniek
delay1=k1+k11;
delay2=k2+k22;
delay3=k3+k33;
delay4=k4+k44;

%% seriove zapojenie prvkov

%%vetva1
vetva1direct=D1*LP1*AP1;
vetva1=feedback(vetva1direct,1,+1);

[b1,a1]=tfdata(vetva1,'v');
IR1=impz(b1,a1,implength);

IR1=conv(FIR_left,IR1);
IR1=IR1(1:implength);

%%vetva2
vetva2direct=D2*LP2*AP2;
vetva2=feedback(vetva2direct,1,+1);

[b2,a2]=tfdata(vetva2,'v');
IR2=impz(b2,a2,implength);

IR2=conv(FIR_left,IR2);
IR2=IR2(1:implength);

%%vetva3
vetva3direct=D3*LP3*AP3;
vetva3=feedback(vetva3direct,1,+1);

[b3,a3]=tfdata(vetva3,'v');
IR3=impz(b3,a3,implength);

IR3=conv(FIR_left,IR3);
IR3=IR3(1:implength);

%%vetva4
vetva4direct=D4*LP4*AP4;
vetva4=feedback(vetva4direct,1,+1);

[b4,a4]=tfdata(vetva4,'v');
IR4=impz(b4,a4,implength);

IR4=conv(FIR_left,IR4);
IR4=IR4(1:implength);

IR=IR1+IR2+IR3+IR4;

IR1buffer(implength)=0;
IR2buffer(implength)=0;
IR3buffer(implength)=0;
IR4buffer(implength)=0;  

%spetna vezba
for i=1:2
    
IR1buffer=delay(IR,delay1)*beta;
IR2buffer=delay(IR,delay2)*beta;
IR3buffer=delay(IR,delay3)*beta;
IR4buffer=delay(IR,delay4)*beta;

IR1=vektorplus(IR1,IR1buffer(1:implength));
IR2=vektorplus(IR2,IR2buffer(1:implength));
IR3=vektorplus(IR3,IR3buffer(1:implength));
IR4=vektorplus(IR4,IR4buffer(1:implength));

IR=IR1+IR2+IR3+IR4;
end

IRtotal=-IR1-IR2+IR3+IR4;

[FIR_left,IRtotal]=eqtflength(FIR_left,IRtotal);
IRleft=conv(FIR_left,IRtotal);

[FIR_right,IRtotal]=eqtflength(FIR_right,IRtotal);
IRright=conv(FIR_right,IRtotal);

IRfinal(:,1)=IRleft';
IRfinal(:,2)=IRright';
%% filtrovanie

if size(x,2)==2
xl=x(:,1);
xr=x(:,2);

[xl,FIR_left]=eqtflength(xl,FIR_left);
yl=conv(xl,FIR_left);
yr=conv(xr,FIR_right);

[yl,IRtotal]=eqtflength(yl,IRtotal);
yleft=conv(yl,IRtotal);

yleft=vektorplus(yl,yleft);
yright=vektorplus(yr,yleft);
[yleft,yright]=eqtflength(yleft,yright);

yleft=vektorplus((wet*yleft),((1-wet)*xl));
yright=vektorplus((wet*yright),((1-wet)*xr'));
[yleft,yright]=eqtflength(yleft,yright);

y(:,1)=yleft;
y(:,2)=yright;

elseif size(x,2)==1
    
[x,IRleft]=eqtflength(x,IRleft);
yl=conv(x,IRleft);
[x,IRright]=eqtflength(x,IRright);
yr=conv(x,IRright);

yleft=vektorplus(wet*yl,(1-wet)*x);
yright=vektorplus(wet*yr,(1-wet)*x);
[yleft,yright]=eqtflength(yleft,yright);

y(:,1)=yleft;
y(:,2)=yright;
end

%odstranenie nul

I=find(abs(y(:,1))>10^(-4),1,'last');
y=y(1:I,:);
handles.y=y;

I=find(abs(IRfinal(:,1))>10^(-4),1,'last');
IRfinal=IRfinal(1:I,:);

%% vykreslenie impluznej odozvy

n=(1:length(IRfinal));


plot(handles.impz,n/Fvz,IRfinal);
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(IRfinal);
I=fft(IRfinal)/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(IRfinal,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 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 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 ga3_Callback(hObject, eventdata, handles)
% hObject    handle to ga3 (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 ga3 as text
%        str2double(get(hObject,'String')) returns contents of ga3 as a double


% --- Executes during object creation, after setting all properties.
function ga3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to ga3 (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 ga4_Callback(hObject, eventdata, handles)
% hObject    handle to ga4 (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 ga4 as text
%        str2double(get(hObject,'String')) returns contents of ga4 as a double


% --- Executes during object creation, after setting all properties.
function ga4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to ga4 (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 ga1_Callback(hObject, eventdata, handles)
% hObject    handle to ga1 (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 ga1 as text
%        str2double(get(hObject,'String')) returns contents of ga1 as a double


% --- Executes during object creation, after setting all properties.
function ga1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to ga1 (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 ga2_Callback(hObject, eventdata, handles)
% hObject    handle to ga2 (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 ga2 as text
%        str2double(get(hObject,'String')) returns contents of ga2 as a double


% --- Executes during object creation, after setting all properties.
function ga2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to ga2 (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 kl1_Callback(hObject, eventdata, handles)
% hObject    handle to kl1 (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 kl1 as text
%        str2double(get(hObject,'String')) returns contents of kl1 as a double


% --- Executes during object creation, after setting all properties.
function kl1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to kl1 (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 kl2_Callback(hObject, eventdata, handles)
% hObject    handle to kl2 (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 kl2 as text
%        str2double(get(hObject,'String')) returns contents of kl2 as a double


% --- Executes during object creation, after setting all properties.
function kl2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to kl2 (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 kl3_Callback(hObject, eventdata, handles)
% hObject    handle to kl3 (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 kl3 as text
%        str2double(get(hObject,'String')) returns contents of kl3 as a double


% --- Executes during object creation, after setting all properties.
function kl3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to kl3 (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 gl1_Callback(hObject, eventdata, handles)
% hObject    handle to gl1 (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 gl1 as text
%        str2double(get(hObject,'String')) returns contents of gl1 as a double


% --- Executes during object creation, after setting all properties.
function gl1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to gl1 (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 gl2_Callback(hObject, eventdata, handles)
% hObject    handle to gl2 (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 gl2 as text
%        str2double(get(hObject,'String')) returns contents of gl2 as a double


% --- Executes during object creation, after setting all properties.
function gl2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to gl2 (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 gl3_Callback(hObject, eventdata, handles)
% hObject    handle to gl3 (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 gl3 as text
%        str2double(get(hObject,'String')) returns contents of gl3 as a double


% --- Executes during object creation, after setting all properties.
function gl3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to gl3 (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 kr1_Callback(hObject, eventdata, handles)
% hObject    handle to kr1 (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 kr1 as text
%        str2double(get(hObject,'String')) returns contents of kr1 as a double


% --- Executes during object creation, after setting all properties.
function kr1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to kr1 (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 kr2_Callback(hObject, eventdata, handles)
% hObject    handle to kr2 (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 kr2 as text
%        str2double(get(hObject,'String')) returns contents of kr2 as a double


% --- Executes during object creation, after setting all properties.
function kr2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to kr2 (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 kr3_Callback(hObject, eventdata, handles)
% hObject    handle to kr3 (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 kr3 as text
%        str2double(get(hObject,'String')) returns contents of kr3 as a double


% --- Executes during object creation, after setting all properties.
function kr3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to kr3 (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 gr1_Callback(hObject, eventdata, handles)
% hObject    handle to gr1 (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 gr1 as text
%        str2double(get(hObject,'String')) returns contents of gr1 as a double


% --- Executes during object creation, after setting all properties.
function gr1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to gr1 (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 gr2_Callback(hObject, eventdata, handles)
% hObject    handle to gr2 (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 gr2 as text
%        str2double(get(hObject,'String')) returns contents of gr2 as a double


% --- Executes during object creation, after setting all properties.
function gr2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to gr2 (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 gr3_Callback(hObject, eventdata, handles)
% hObject    handle to gr3 (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 gr3 as text
%        str2double(get(hObject,'String')) returns contents of gr3 as a double


% --- Executes during object creation, after setting all properties.
function gr3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to gr3 (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 beta_Callback(hObject, eventdata, handles)
% hObject    handle to beta (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 beta as text
%        str2double(get(hObject,'String')) returns contents of beta as a double


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


% --- 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);
