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

% Last Modified by GUIDE v2.5 07-Sep-2011 09:35:49

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @RL_OpeningFcn, ...
                   'gui_OutputFcn',  @RL_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 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)
set(handles.text7,'Visible','off');
set(handles.text8,'Visible','off');
set(handles.text9,'Visible','off');
set(handles.text10,'Visible','off');

set(handles.prdnorm,'String','');
set(handles.prdlognorm,'String','');
set(handles.prdgev,'String','');
set(handles.prdunif,'String','');

set(handles.prdnorm,'Visible','off');
set(handles.prdlognorm,'Visible','off');
set(handles.prdgev,'Visible','off');
set(handles.prdunif,'Visible','off');

set(handles.vinuti,'String','');
set(handles.krit,'String','');
set(handles.Pf,'String','');
set(handles.nazev1,'String','');
set(handles.pocetzapojeni1,'String','');


clc
guidata(hObject, handles);


% --- Executes just before RL is made visible.
function RL_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 RL (see VARARGIN)

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

% Update handles structure
guidata(hObject, handles);

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


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


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


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


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


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

% Hint: get(hObject,'Value') returns toggle state of checkbox1

if get(handles.checkbox1,'Value')==1
    handles.rozdeleni1=1;
    rozdeleni1=handles.rozdeleni1;
else
    handles.rozdeleni1=0;
    rozdeleni1=handles.rozdeleni1;
end
    guidata(hObject, handles);

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

% Hint: get(hObject,'Value') returns toggle state of checkbox2
if get(handles.checkbox2,'Value')==1
handles.rozdeleni2=1;
    rozdeleni2=handles.rozdeleni2;
else
    handles.rozdeleni2=0;
    rozdeleni2=handles.rozdeleni2;
end
guidata(hObject, handles);
% --- Executes on button press in checkbox3.
function checkbox3_Callback(hObject, eventdata, handles)
% hObject    handle to checkbox3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of checkbox3
if get(handles.checkbox3,'Value')==1
handles.rozdeleni3=1;
    rozdeleni3=handles.rozdeleni3;
else
    handles.rozdeleni3=0;
    rozdeleni3=handles.rozdeleni3;
end
guidata(hObject, handles);

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

% Hint: get(hObject,'Value') returns toggle state of checkbox4
if get(handles.checkbox4,'Value')==1
handles.rozdeleni4=1;
    rozdeleni4=handles.rozdeleni4;
else
    handles.rozdeleni4=0;
    rozdeleni4=handles.rozdeleni4;
end
guidata(hObject, handles);

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

handles.nazev=get(handles.nazev1,'String');
nazev=handles.nazev;
handles.pocetzapojeni11=get(handles.pocetzapojeni1,'String');
pocetzapojeni=str2num(handles.pocetzapojeni11);
[handles.Tg]=load_data(nazev,pocetzapojeni);
Tg=handles.Tg;

handles.pocetvinuti=get(handles.vinuti,'String');
pocetvinuti=str2num(handles.pocetvinuti);
handles.krithodnota=get(handles.krit,'String');
krithodnota=str2num(handles.krithodnota);
handles.smerpstporuchy=get(handles.Pf,'String');
smerpstporuchy=str2num(handles.smerpstporuchy);

[PRDnorm,PRDlognorm,PRDgev,PRDunif]=DistrFce(Tg,pocetvinuti,krithodnota,smerpstporuchy,handles.rozdeleni1,handles.rozdeleni2,handles.rozdeleni3,handles.rozdeleni4);
if handles.rozdeleni1==1
set(handles.text7,'Visible','on');
set(handles.prdnorm,'Visible','on');
set(handles.prdnorm,'String',PRDnorm);
end
if handles.rozdeleni2==1
set(handles.text8,'Visible','on');
set(handles.prdlognorm,'Visible','on');
set(handles.prdlognorm,'String',PRDlognorm);
end
if handles.rozdeleni3==1
set(handles.text9,'Visible','on');
set(handles.prdgev,'Visible','on');
set(handles.prdgev,'String',PRDgev);
end
if handles.rozdeleni4==1
set(handles.text10,'Visible','on');
set(handles.prdunif,'Visible','on');
set(handles.prdunif,'String',PRDunif);
end
guidata(hObject, handles);


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


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


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


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


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


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


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