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

% Last Modified by GUIDE v2.5 10-Mar-2010 17:33:13

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @slidergui1_OpeningFcn, ...
                   'gui_OutputFcn',  @slidergui1_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 slidergui1 is made visible.
function slidergui1_OpeningFcn(hObject, eventdata, handles, varargin)

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

if ~isempty(varargin)
    % Write data to gui handles
    handles.dataXYZ = varargin{1};
    working_dir = 'Working directory not set';    
else
    % Select working directory
    working_dir = uigetdir;
    cd(working_dir);
    % Write data to gui handles
    handles.dataXYZ = Read_Cache;
end


  

% plot the figure 1
hold(handles.axes1,'off');
handles.axes1_timeseries = plot(handles.axes1,handles.dataXYZ.Matlabtime, handles.dataXYZ.Z_RD);
set(handles.axes1,'ylim',[0 15]);
set(handles.axes1,'xlim',[handles.dataXYZ.Matlabtime(1) handles.dataXYZ.Matlabtime(end)]);
title(handles.axes1,'Antenna Elevation')
ylabel(handles.axes1,'[m] referenced to NAP')
datetick(handles.axes1)
hold(handles.axes1,'on');

% plot figure 2
hold(handles.axes2,'off');
handles.axes2_timeseries = plot(handles.axes2,handles.dataXYZ.X_RD,handles.dataXYZ.Y_RD,'.b','markersize',5);
% set(handles.axes1,'linewidth',2);
xlabel(handles.axes2,'X_{RD} [m]')
ylabel(handles.axes2,'Y_{RD} [m]')
title(handles.axes2,'Top View')
axis(handles.axes2,'equal')
hold(handles.axes2,'on');




%%% Slider does not work with Matlab timestamps. Therefore the day and time
%%% are seperated. The day is written to userdata and can be used from
%%% there.
time_day = floor(handles.dataXYZ.Matlabtime(1));
mintime = handles.dataXYZ.Matlabtime(1)-time_day;
maxtime = handles.dataXYZ.Matlabtime(end)-time_day;

%%% set slider1 properties
set(handles.slider1,'min',mintime)
set(handles.slider1,'value',mintime)
set(handles.slider1,'max',maxtime)
set(handles.slider1,'userdata',time_day)
set(handles.slider1,'sliderstep',[1/((maxtime-mintime)*24*60*60) 0.01])

%include gui header
set(handles.figure1,'name',['Data Process Tool - Working directory [' working_dir ']'])

%include time line marker
axes(handles.axes1)
handles.timeline1 = plot([handles.dataXYZ.Matlabtime(1)...
    handles.dataXYZ.Matlabtime(1)],[0 100],'--r');
handles.timeline2 = plot(handles.axes2,handles.dataXYZ.X_RD(1),...
    handles.dataXYZ.Y_RD(1),'or','linewidth',3);

%Check and load event file
if exist('event.txt') == 2
    handles.event = read_eventfile;
    % update eventpanel
    update_eventpanel(handles);
%     plot_eventblocks(handles) 
end

% Update handles structure
guidata(hObject, handles);

%%% User defined embedded functions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function update_axes(time,handles)

% Delete any previous indicators of handles.time
% if length(get(handles.axes1,'Children'))>1
%     temp = get(handles.axes1,'Children');
%     delete(temp(1));
% end
% if length(get(handles.axes2,'Children'))>1
%     temp = get(handles.axes2,'Children');
%     delete(temp(1));
% end

% update time indicators
% axes1
set(handles.timeline1,'Xdata',[handles.time handles.time])
% find index for associated handles.time
[dum,index] = min(abs(handles.dataXYZ.Matlabtime-handles.time));
% axes2
set(handles.timeline2,'Xdata',handles.dataXYZ.X_RD(index))
set(handles.timeline2,'Ydata',handles.dataXYZ.Y_RD(index))

% change slider value
set(handles.slider1,'value',handles.time-get(handles.slider1,'userdata'))

% change value in editor boxes for handles.time
set(handles.edit1,'string',datestr(handles.time,'HH'));
set(handles.edit2,'string',datestr(handles.time,'MM'));
set(handles.edit3,'string',datestr(handles.time,'SS'));

% change value in height
set(handles.text12,'string',handles.dataXYZ.Z_RD(index));

guidata(handles.figure1, handles);

function update_eventpanel(handles)
%check for existing event field
if isfield(handles,'event') &  length(handles.event) ~= 1
    if str2num(get(handles.edit8,'string'))>length(handles.event)
        % new field is created
        eventnr = str2double(get(handles.edit8,'string'));
        handles.event(eventnr).begintime = 'xx:xx:xx';
        handles.event(eventnr).endtime = 'xx:xx:xx';
        handles.event(eventnr).surveyorheight = 'x.xx';
        set(handles.text19,'string',['out of ' num2str(eventnr)]);

        %slider
        set(handles.slider6,'max',eventnr);
        set(handles.slider6,'value',eventnr);
        set(handles.slider6,'min',1);
        set(handles.slider6,'sliderstep',[1/(length(handles.event)-1) 1]);

    end
    %event exist and fields updated scrolling trough events
    eventnr = str2double(get(handles.edit8,'string'));
    set(handles.text19,'string',['out of ' num2str(length(handles.event))]);
    set(handles.edit6,'string',handles.event(eventnr).begintime);
    set(handles.edit7,'string',handles.event(eventnr).endtime);
    set(handles.edit12,'string',handles.event(eventnr).surveyorheight);

    % slider
    set(handles.slider6,'max',length(handles.event));
    set(handles.slider6,'value',eventnr);
    set(handles.slider6,'min',1);
    set(handles.slider6,'sliderstep',[1/(length(handles.event)-1) 1]);
    %     end

elseif length(handles.event) == 1
    %only one event is stored so the slider needs to be limited
    eventnr = 1;
    set(handles.text19,'string',['out of ' 1]);
    set(handles.edit6,'string',handles.event(eventnr).begintime);
    set(handles.edit7,'string',handles.event(eventnr).endtime);
    set(handles.edit12,'string',handles.event(eventnr).surveyorheight);
    set(handles.slider6,'sliderstep',[0 0]);
else
    %no events are stored and slider needs to be limited
    set(handles.slider6,'sliderstep',[0 0]);
end
guidata(handles.figure1, handles);


function plot_eventblocks(handles)
% Does not work yet
if 0 
%Plot events in figure

% determine range of z values
zlowerlimit = min(handles.dataXYZ.Z_RD)-1;
zrange = max(handles.dataXYZ.Z_RD)-zlowerlimit+2;

% do not include xx.xx.xx event
blocks = 0;
for i = 1 : length(handles.event)
    if handles.event(i).begintime(1) ~= 'x'
        blocks = blocks + 1;            
%       only plot block when or changing adding one        
        if length(get(handles.axes1,'Children'))<(blocks+2)
            begin = datenum(handles.event(i).begintime,'HH:MM:SS');
            duration = datenum(handles.event(i).endtime,'HH:MM:SS')-begin;
            axes(handles.axes1);
            handles.event(i).plot = rectangle('Position',[begin,zlowerlimit,...
                duration,zrange],'linewidth',2,'facecolor',[.8 1 .8],...
                'edgecolor',[.2 .8 0]);
% ****** HERE WE CAN INCLUDE A PROCEDURE FOR MODIFYING EXISTING BLOCKS ***
%         elseif length(get(handles.axes1,'Children'))==(blocks+2)
%             begin = datenum(handles.event(i).begintime,'HH:MM:SS');
%             duration = datenum(handles.event(i).endtime,'HH:MM:SS')-begin;
%             axes(handles.axes1);
%             handles.event(i).plot = rectangle('Position',[begin,zlowerlimit,...
%                 duration,zrange],'linewidth',2,'facecolor',[.8 1 .8],...
%                 'edgecolor',[.2 .8 0]);
% 

        end
    end               
end


% length(get(handles.axes1,'Children'))

%restore plotting order to move blocks to background
%get amount of children within axes1

% event blocks are the two last children
for i = 1:blocks
    eventchildren(i,1) = handles.event(i).plot;
end
child_new = [handles.timeline1; handles.axes1_timeseries; eventchildren];
set(handles.axes1,'Children',child_new);

%update handles
guidata(handles.figure1, handles);
end
            
                
                





    


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% --- Outputs from this function are returned to the command line.
function varargout = slidergui1_OutputFcn(hObject, eventdata, handles) 

% Get default command line output from handles structure
varargout{1} = handles.output;

% --- Executes on slider movement.
function slider1_Callback(hObject, eventdata, handles)

% Get time of day and add day
handles.time = get(hObject,'Value') + get(hObject,'userdata');

update_axes(handles.time,handles);

% --- Executes during object creation, after setting all properties.
function slider1_CreateFcn(hObject, eventdata, handles)

if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end

function edit1_Callback(hObject, eventdata, handles)
 handles.time = datenum([get(handles.edit1,'String') get(handles.edit2,'String') get(handles.edit3,'String')],'HHMMSS');
 update_axes(handles.time,handles);
 
% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function edit2_Callback(hObject, eventdata, handles)
 handles.time = datenum([get(handles.edit1,'String') get(handles.edit2,'String') get(handles.edit3,'String')],'HHMMSS');
 update_axes(handles.time,handles);

% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit2 (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 edit3_Callback(hObject, eventdata, handles)
 handles.time = datenum([get(handles.edit1,'String') get(handles.edit2,'String') get(handles.edit3,'String')],'HHMMSS');
 update_axes(handles.time,handles);

% --- Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit3 (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 edit4_Callback(hObject, eventdata, handles)
% hObject    handle to edit4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

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



% --- Executes during object creation, after setting all properties.
function figure1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to figure1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% --- Executes during object creation, after setting all properties.
function text5_CreateFcn(hObject, eventdata, handles)
% hObject    handle to text5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% --- If Enable == 'on', executes on mouse press in 5 pixel border.
% --- Otherwise, executes on mouse press in 5 pixel border or over text5.
function text5_ButtonDownFcn(hObject, eventdata, handles)
% hObject    handle to text5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
 set(handles.edit6,'String',datestr(handles.time,'HH:MM:SS'))

% hObject    handle to pushbutton4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
 set(handles.edit7,'String',datestr(handles.time,'HH:MM:SS'))
% hObject    handle to pushbutton5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

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

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

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

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

% --- Executes on key press with focus on pushbutton4 and no controls selected.
function pushbutton4_KeyPressFcn(hObject, eventdata, handles)
% hObject    handle to pushbutton4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% --- Executes on button press in pushbutton6.
function pushbutton6_Callback(hObject, eventdata, handles)
working_dir = uigetdir;
cd(working_dir);
set(handles.text13,'string',working_dir)

% --- Executes on key press with focus on pushbutton6 and no controls selected.
function pushbutton6_KeyPressFcn(hObject, eventdata, handles)
% hObject    handle to pushbutton6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

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

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

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

% --------------------------------------------------------------------
function Data2_Callback(hObject, eventdata, handles)
% hObject    handle to Data2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% --------------------------------------------------------------------
function uitoggletool3_ClickedCallback(hObject, eventdata, handles)
% hObject    handle to uitoggletool3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% ---------Callback for open folder-----------------------------------
function uipushtool1_ClickedCallback(hObject, eventdata, handles)
% hObject    handle to uipushtool1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

%Reload gui
slidergui1_OpeningFcn(handles.figure1,[], handles)


% --- Executes on button press in pushbutton12.
function pushbutton12_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton12 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
eventnr = str2double(get(handles.edit8,'string'));
handles.event(eventnr).begintime = get(handles.edit6,'string');
handles.event(eventnr).endtime = get(handles.edit7,'string');
handles.event(eventnr).surveyorheight = get(handles.edit12,'string');
guidata(hObject, handles);
set(handles.text19,'string',['out of ' num2str(length(handles.event))])
% go to next event
set(handles.edit8,'string',num2str(eventnr +1))

%does not work yet

update_eventpanel(handles)
plot_eventblocks(handles)





% --- Executes on button press in pushbutton13.
% this is where the event.txt file is created
function pushbutton13_Callback(hObject, eventdata, handles)

fid = fopen('event.txt','wt');
fprintf(fid,['This file is automatically generated by the slidergui \n' ...
    'It contains events for which the data is valid \n' ...
    'For every event the surveyorheight is specified\n' ...
    '\n' ...
    'Survey date\t' datestr(floor(handles.dataXYZ.Matlabtime(1))) '\n' ...
    'Processed on\t' datestr(now) '\n']);

for i = 1:length(handles.event);
    %write all event except when x is found in the begintime
    if handles.event(i).begintime(1) ~= 'x'
        fprintf(fid,'\n');
        fprintf(fid,'Event %.0f\n',i);
        fprintf(fid,['Begintime ' handles.event(i).begintime '\n']);
        fprintf(fid,['Endtime ' handles.event(i).endtime '\n']);
        fprintf(fid,['Surveyorheight ' handles.event(i).surveyorheight '\n']);
    end
end

fclose(fid);
msgbox(['Data Stored in file event.txt'],'YO')


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


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


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

%make sure not to overwrite previous stuff
Save_valid_data(handles);
% Final_XYZ = [];
% 
% for i = 1:length(handles.event)
%     %find start and endtimes
%     [dum begin_ind] = min(abs(handles.dataXYZ.Matlabtime-...
%         datenum(handles.event(i).begintime,'HH:MM:SS')));
%     [dum end_ind] = min(abs(handles.dataXYZ.Matlabtime-...
%         datenum(handles.event(i).endtime,'HH:MM:SS')));
% 
%     % Extract from dataset
%     Final_XYZ = [Final_XYZ ; handles.dataXYZ.X_RD(begin_ind:end_ind)'...
%         handles.dataXYZ.Y_RD(begin_ind:end_ind)'...
%         handles.dataXYZ.Z_RD(begin_ind:end_ind)'- str2double(handles.event(i).surveyorheight)]; 
% end
%  %plot outcome
% figure
% scatter(Final_XYZ(:,1),Final_XYZ(:,2),3,Final_XYZ(:,3));
% 
% % save outcome
% fid = fopen('../Products/XYZ_RDNAP.txt','wt');
% fprintf(fid,['This file is automatically generated by the slidergui.\n'...
%     'It contains the surface elevation of the measured path \n' ...
%     'The values are extracted from the total survey and corrected for walker heigth \n\n']);
% 
% fprintf(fid, '%f\t %f\t %f\n', Final_XYZ');
% 
% fclose(fid);


% --- Executes on slider movement.
function slider6_Callback(hObject, eventdata, handles)
% hObject    handle to slider6 (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,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
set(handles.edit8,'string',num2str(get(hObject,'Value')));
update_eventpanel(handles);




% --- Executes during object creation, after setting all properties.
function slider6_CreateFcn(hObject, eventdata, handles)
% hObject    handle to slider6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end


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


% --- If Enable == 'on', executes on mouse press in 5 pixel border.
% --- Otherwise, executes on mouse press in 5 pixel border or over pushbutton14.
function pushbutton14_ButtonDownFcn(hObject, eventdata, handles)
% hObject    handle to pushbutton14 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


