function varargout = Program(varargin)

gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @Program_OpeningFcn, ...
                   'gui_OutputFcn',  @Program_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

function Program_OpeningFcn(hObject, eventdata, handles, varargin)

set(handles.axes1, 'Visible', 'off');
set(handles.axes2, 'Visible', 'off');
set(handles.axes3, 'Visible', 'off');
set(handles.Volba_mereni_popup, 'Enable', 'off');
set(handles.PP_text, 'Visible', 'off');
set(handles.E_text, 'Visible', 'off');
set(handles.S_text, 'Visible', 'off');

handles.output = hObject;
guidata(hObject, handles);

function varargout = Program_OutputFcn(hObject, eventdata, handles) 

varargout{1} = handles.output;

function Volba_mereni_popup_Callback(hObject, eventdata, handles)

Vykresleni(handles);

function Nacist_button_Callback(hObject, eventdata, handles)

global signal;

[jmeno, cesta] = uigetfile({'*.mat',  'Signalové soubory (*.mat)'}, 'Načíst signál');

if jmeno ~= 0
    
    set(handles.Nacist_edit, 'String', [cesta jmeno]);
    
    signal = load([cesta jmeno]);
    nazev = fieldnames(signal);
    signal = signal.(nazev{1});

    pocetmereni = size(signal, 2) / 3;

    set(handles.axes1, 'Visible', 'on');
    set(handles.axes2, 'Visible', 'on');
    set(handles.axes3, 'Visible', 'on');
    set(handles.Volba_mereni_popup, 'Enable', 'on', 'String', 1:3);
    set(handles.PP_text, 'Visible', 'on');
    set(handles.E_text, 'Visible', 'on');
    set(handles.S_text, 'Visible', 'on');

    Filtrace(handles, pocetmereni);
    Vykresleni(handles);
end

function figure1_CloseRequestFcn(hObject, eventdata, handles)

clearvars -global;

delete(hObject);
