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

% Last Modified by GUIDE v2.5 05-Mar-2013 14:56:53

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

% load('results.mat'); % - now res is global
res = varargin{1};
set(handles.fig1, 'Visible', 'on');
axes(handles.fig1);
semilogy(res.graf_CISN, res.graf_chybovost);
xlim([res.graf_CISN(1) res.graf_CISN(end)]);
ylabel('Chybovost [-]');
set(handles.figure1, 'Name', ['Závislost chybovosti na poměru ' res.typRad]);
set(handles.fig1, 'YScale','log','YMinorTick','on',...
    'YMinorGrid','on',...
    'YGrid','on',...
    'XGrid','on');
if(min(res.graf_chybovost) > 0.1)
    ylim(handles.fig1,[1e-3 1]);
end
% box(axes1,'on');
% hold(axes1,'all');
RowName = cell(2);
RowName{1} = ['Hodnota poměru ' res.typRad ' [dB]' ];
RowName{2} = 'Chybovost [-]';
set(handles.uitab1, 'RowName', RowName);
xlabel(sprintf('%s [dB]', res.typRad));
title(sprintf('Závislost chybovosti na poměru %s',res.typRad));
set(handles.uitab1, 'Data', [res.graf_CISN ;res.graf_chybovost]);
% Choose default command line output for Graf_CISN
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

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


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