function varargout = vysledek(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @vysledek_OpeningFcn, ...
                   'gui_OutputFcn',  @vysledek_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

% Inicializační hodnoty
function vysledek_OpeningFcn(hObject, eventdata, handles, varargin)
global w ll vv lvv R u

if length(R)>14
    set(handles.text_cont,'Visible','on')
end

xmin=-5;
xmax=max(ll)*1000+5;
odskok=(max(w)*1000-min(w)*1000)/10;
if -min(w)*1000<=0
    ymax=odskok;
else
    ymax=-min(w)*1000+odskok;
end
ymin=-max(w)*1000-odskok;

% zobrazení průhybové čáry a osy
axes(handles.axes_pruhyb)
plot(ll*1000,-w*1000,'-o','MarkerEdgeColor','k','MarkerFaceColor','g','LineWidth',2);
hold on
plot([0 max(ll)*1000],[0 0],'-r')
grid on
title('Průhybová čára')
xlabel('l [mm]')
ylabel('w [mm]')
xlim([xmin xmax])
ylim([ymin ymax])

% zobrazení vazeb
switch u
    case 1
        for i=1:length(vv)
            if vv(i)==1
                plot([lvv(i)*1000 lvv(i)*1000],[ymin ymax],'--k')
            end
        end
    case 2
        for i=1:length(vv)
            if vv(i)==1
                plot([lvv(i)*1000 lvv(i)*1000],[ymin ymax],'--k')
                plot([0 0],[ymin ymax],'--k')
            end
        end
    case 3
        for i=1:length(vv)
            if vv(i)==1
                plot([lvv(i)*1000 lvv(i)*1000],[ymin ymax],'--k')
                plot([lvv(end)*1000 lvv(end)*1000],[ymin ymax],'--k')
            end
        end
    case 4
        for i=1:length(vv)
            if vv(i)==1
               plot([lvv(i)*1000 lvv(i)*1000],[ymin ymax],'--k')
               plot([0 0],[ymin ymax],'--k')
               plot([lvv(end)*1000 lvv(end)*1000],[ymin ymax],'--k')
            end
        end
end
hold off

% zobrazení hodnot reakcí ve vazbách
for i=1:length(R)
    r{i}=['R',num2str(i),':'];
end
if sum(vv)~=0
    set(handles.text_r,'String',r')
    set(handles.text_reakce,'String',R')
end

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

function varargout = vysledek_OutputFcn(hObject, eventdata, handles) 
varargout{1} = handles.output;


% Textový výpis dat
function push_text_Callback(hObject, eventdata, handles)
figure(textdata)
