function GUI_data(data,frekvence)

scrsz = get(0,'ScreenSize');
rozmery = size(data);
delka = rozmery(2);    

% veci ohledne okna

window_data = figure('Units','characters',...
            'HandleVisibility','callback',...
            'Renderer','painters',...
            'MenuBar','none', ...
            'numbertitle','off', ...
            'name','Input Data', ...
            'Units','pixels', ... 
            'Position',[scrsz(3)/4 scrsz(4)/4 scrsz(3)/2 scrsz(4)/2], ...
            'ResizeFcn',@figResize);
        
    %%    
% Okno rozdelene do 4 panelu
% v levem panelu jsou jednotlive kanaly
L_Panel_sirka = scrsz(3)/5;
L_Panel_vyska = scrsz(4)/2-10;
L_Panel_odsazeni = 10;

L_Panel = uipanel('BorderType','etchedin',...
		'Units','characters',...
		'Parent',window_data, ...
        'Title','Channels', ...
        'Units','pixels', ...
		'Position',[L_Panel_odsazeni L_Panel_odsazeni L_Panel_sirka L_Panel_vyska],...
        'TitlePosition','centertop');
   
%% uprostred jsou jejich grafy 

Podrobnosti_odsazeni = 30;
Podrobnosti_sirka = 2*L_Panel_sirka;
Podrobnosti_vyska = L_Panel_vyska;
    
Podrobnosti = uipanel('BorderType','etchedin',...
            'Units','characters',...
            'Parent',window_data, ...
            'Title','Graph', ...
            'Units','pixels', ...
            'Position', ...
            [Podrobnosti_odsazeni+L_Panel_sirka Podrobnosti_odsazeni Podrobnosti_sirka Podrobnosti_vyska],...
            'TitlePosition','centertop'); 
%% v pravem pak jejich vyber
        
R_Panel_sirka = scrsz(3)/5;
R_Panel_vyska = scrsz(4)/2-10;
R_Panel_odsazeni = L_Panel_sirka + L_Panel_odsazeni + Podrobnosti_sirka + 2*Podrobnosti_odsazeni;    
    
R_Panel = uipanel('BorderType','etchedin',...
		'Units','characters',...
		'Parent',window_data, ...
        'Title','Check', ...
        'Units','pixels', ...
		'Position',[R_Panel_odsazeni R_Panel_vyska/3 R_Panel_sirka R_Panel_vyska/1.5+10],...
        'TitlePosition','centertop'); 
 
%% v pravem dolnim se potvrzuji    
    
F_Panel_sirka = R_Panel_sirka;
F_Panel_odsazeni = R_Panel_odsazeni;
F_Panel_vyska = R_Panel_vyska/3.5;
    
F_Panel = uipanel('BorderType','etchedin',...
		'Units','characters',...
		'Parent',window_data, ...
        'Title','Choose', ...
        'Units','pixels', ...
		'Position',[F_Panel_odsazeni 10 F_Panel_sirka F_Panel_vyska],...
        'TitlePosition','centertop');     
 %% jednotlive ovladaci prvky
% Tlacitka    
    
Remove_button = uicontrol(F_Panel,'Style','Pushbutton','String','Uncheck',...
              'Parent',F_Panel,'Units','pixels', ... ...
              'Position',[F_Panel_sirka/3,F_Panel_vyska/1.8,F_Panel_sirka/4,F_Panel_vyska/4],...
              'Callback',@removeAll_callback); 
          
All_button = uicontrol(F_Panel,'Style','Pushbutton','String','All',...
              'Parent',F_Panel,'Units','pixels', ... ...
              'Position',[10,F_Panel_vyska/1.8,F_Panel_sirka/4,F_Panel_vyska/4],...
              'Callback',@checkAll_callback);    

Accept_button = uicontrol(F_Panel,'Style','Pushbutton','String','Load',...
              'Parent',F_Panel,'Units','pixels', ... ...
              'Position',[F_Panel_sirka/5,15,F_Panel_sirka/4,F_Panel_vyska/3],...
              'Callback',@accept_callback);
          
%%          
          
% vytvoreni os na vykresleni jednotliveho kanalu jen tak na shlednuti do podrobnosti 
     
 axes_data = axes('Units','pixels','Position',[50 40 Podrobnosti_sirka/2-80,Podrobnosti_vyska-70], ...
                  'Parent',Podrobnosti);   
   
% rychlejsi nez plot - lhandle

% lHandle = line(nan,nan);


%% funkce na vypsani podrobnosti o kanalu

% zavolani funkce pro vypsani nazavu jednotlivych kanalu

 data_buttons = createNames();
 data_checkboxes = createCheckBoxes();


%% resize funkce pro zmenu okna

% zmena velikosti hlavniho okna
    function figResize(src,evt)
        fpos = get(window_data,'Position');
        set(L_Panel,'Position',...
            [L_Panel_odsazeni L_Panel_odsazeni fpos(3)/5 fpos(4)-L_Panel_odsazeni]);
        
        set(Podrobnosti,'Position', ...
            [Podrobnosti_odsazeni+fpos(3)/5 L_Panel_odsazeni  fpos(3)/2.5 fpos(4)-L_Panel_odsazeni]);
        
        set(R_Panel,'Position',...
            [-10+2*Podrobnosti_odsazeni+fpos(3)/5+fpos(3)/2.5 fpos(4)/3 fpos(3)/4 fpos(4)/1.5]);    
        
        set(F_Panel,'Position',...
            [-10+2*Podrobnosti_odsazeni+fpos(3)/5+fpos(3)/2.5 10 fpos(3)/4 fpos(4)/3.5]);
    end

%% funkce vytvoreni komponentu

% vytvoreni tlacitek pro jednotlive kanaly, uprava na spravnou velikost
    function buttons = createNames() 
        
        gpos = get(L_Panel,'Position');
        
        pocet = delka;
        
             
             if(delka==1)         
                button_names = uicontrol('Style','pushbutton','String',delka,...
                    'Units','pixels','Position',[10 gpos(4)-20-(L_Panel_vyska/10)*1 L_Panel_sirka/2.5 L_Panel_vyska/10],'parent',L_Panel,...
                    'HandleVisibility','off','Callback',@writeInfo_callback);  
                buttons = button_names;
                return;
             end
            
        
             if(pocet<=10)
                for i=1:delka           
                button_names(i) = uicontrol('Style','pushbutton','String',i,...
                    'Units','pixels','Position',[10 gpos(4)-20-(L_Panel_vyska/10)*i L_Panel_sirka/2.5 L_Panel_vyska/10],'parent',L_Panel,...
                    'HandleVisibility','off','Callback',@writeInfo_callback);
                end
             end
                
             if(pocet>10 && pocet<=20) 
                for i=1:delka           
                button_names(i) = uicontrol('Style','pushbutton','String',i,...
                    'Units','pixels','Position',[10 gpos(4)-20-(L_Panel_vyska/20)*i L_Panel_sirka/2.5 L_Panel_vyska/20],'parent',L_Panel,...
                    'HandleVisibility','off','Callback',@writeInfo_callback);
                end
             end
             
             if(pocet>20)
                for i=1:delka           
                button_names(i) = uicontrol('Style','pushbutton','String',i,...
                    'Units','pixels','Position',[10 gpos(4)-20-(L_Panel_vyska/pocet)*i*9/10 L_Panel_sirka/2.5 (L_Panel_vyska/pocet)],'parent',L_Panel,...
                    'HandleVisibility','off','Callback',@writeInfo_callback);
                end
             end
             
        buttons = button_names;
    end 
%%
% vtvoreni checkboxu pro jednotlive kanaly
    function boxy = createCheckBoxes()
        
        
        gpos = get(R_Panel,'Position');
        pocet = delka;
        
        if(delka==1)
               checkboxes = uicontrol('Style','checkbox','Value',0,'String',delka,...
               'Units','pixels','Position',[10 gpos(4)-30-((R_Panel_vyska-gpos(2))/10)*1*10/9 R_Panel_sirka/5 R_Panel_vyska/10],'parent',R_Panel);    
               
               boxy = checkboxes;
               return;
        end
        
        
        if(pocet<=10)
            for i=1:delka 
               checkboxes(i) = uicontrol('Style','checkbox','Value',0,'String',i,...
               'Units','pixels','Position',[10 gpos(4)-30-((R_Panel_vyska-gpos(2))/10)*i*10/9 R_Panel_sirka/5 R_Panel_vyska/10],'parent',R_Panel);    
            end
        end
        
        if(pocet>10 && pocet<=20) 
            for i=1:delka          
                checkboxes(i) = uicontrol('Style','checkbox','Value',0,'String',i,...
                'Units','pixels','Position',[10 gpos(4)-30-((R_Panel_vyska-gpos(2))/20)*i*10/9 R_Panel_sirka/5 R_Panel_vyska/20],'parent',R_Panel);     
            end 
        end
        
        if(pocet>20)
            for i=1:delka  
                if(i<=round(pocet/2))
                checkboxes(i) = uicontrol('Style','checkbox','Value',0,'String',i,...
                'Units','pixels','Position',[10 gpos(4)-30-((R_Panel_vyska-30-gpos(2))/round(pocet/2))*i R_Panel_sirka/5 R_Panel_vyska/round(pocet/2)*3/4],'parent',R_Panel);     
                else          
                checkboxes(i) = uicontrol('Style','checkbox','Value',0,'String',i,...
                'Units','pixels','Position',[R_Panel_sirka/3 gpos(4)-30-((R_Panel_vyska-20-gpos(2))/round(pocet/2))*(i-round(pocet/2)) R_Panel_sirka/5 R_Panel_vyska/round(pocet/2)*3/4],'parent',R_Panel);          
                end 
            end
        end
        
        
        boxy = checkboxes;
        
        % defaultni nastaveni, aby byl prvni checkbox zaskrtnut
        set(boxy(1),'Value',1);
    end

%% funkce jednotlivych tlacitek

% zaskrtnuti vsech kanalu
    function checkAll_callback(source,eventdata)  
        for i=1:delka
            set(data_checkboxes(i),'Value',1);
        end      
    end

% vyskrtnuti vsech kanalu
    function removeAll_callback(source,eventdata)  
        for i=1:delka
            set(data_checkboxes(i),'Value',0);
        end  
        
    end

% ocislovani kanalu
    function writeInfo_callback(source,eventdata)
       
        cislo = 1;
        for i=1:delka
            if(get(data_buttons(i),'Value')==1)
                cislo = i;
            end
        end
  
% parametry vykresleni  
% vtvoreni casove osy

    time_vector = 0:1/frekvence:length(data)/frekvence-1/frekvence;    
    plot(axes_data,time_vector,data(:,cislo));
    xlabel('t [s]');
    ylabel('Amplitude [-]')
    
    end

% nacteni jen odpovidajicich kanalu

    function accept_callback(source,eventdata) 
        
        
        for i=1:delka
            value_check = get(data_checkboxes(i),'Value');
            
            if(value_check==1)
                hdata_new{i}=i;
            else
                hdata_new{i}=nan;
            end   
        end
        
        if(delka==1)
            
           hdata_new{2}=nan; 
           b=hdata_new;
           setappdata(0,'NewData',b);
           close;
           
        else
            
           b=hdata_new;
           setappdata(0,'NewData',b);
           close;
        end
        
               
    end


end