Contents

INITIALIZE GUI

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

% Last Modified by GUIDE v2.5 23-Apr-2014 01:14:19

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @AutoEditEvents_OpeningFcn, ...
                   'gui_OutputFcn',  @AutoEditEvents_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
% 23-Apr-2014 02:32:00

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

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

% Update handles structure
guidata(hObject, handles);

% Load variables
y2 = evalin('base','y1');
assignin('base','y2',y2); %write to workspace

% Plot the first Event in window
myEvents = evalin('base','myEvents'); %load myEvents
Eventplot = y2(myEvents(1,1):myEvents(1,3)); %get 1st event to be plotted
mintemp = min(Eventplot);
Eventplot = Eventplot - mintemp; %translate event to origin
plot(handles.axes1,Eventplot,'k.') %update axes1

% Update display of text1
set(handles.text1,'String',['Event ',num2str(1)])

% Initialize slider1
v1 = length(myEvents);
mymax = v1;
mymin = 1;
mystep = [1, 0.2*(mymax-mymin)]*1/(mymax-mymin); %increment slider fractions of #frames: [1/#frame 20%#frames]
set(handles.slider1,'Min',mymin);
set(handles.slider1,'Max',(mymax));
set(handles.slider1,'SliderStep', mystep);
set(handles.slider1,'Value',1);
set(handles.slider1,'interruptible','off');

% Fill static text2 box
mydirChoose = evalin('base','mydirChoose');
parsemypath = strfind(mydirChoose,'\'); %get all indices where '\' exists
myfolder = mydirChoose(parsemypath(end)+1:end); %get all info after last '\'
set(handles.text2,'string',myfolder); %info after last '\' is folder name

% Fill static text3 box
cellname = evalin('base','cellname');
set(handles.text3,'string',cellname);


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


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


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

%-------------

CLICK SLIDER

back to top
%-------------
% Event Selection Slider
% --- Executes on slider movement.
      function slider1_Callback(hObject, eventdata, handles)
      % hObject    handle to slider1 (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
      slider1pos = get(handles.slider1,'Value'); %get slider position
      %Update axes1
      y2 = evalin('base','y2'); %load filtered signal
      myEvents = evalin('base','myEvents'); %load myEvents
      myEventsFlag = evalin('base','myEventsFlag'); %load myEventsFlag
      % myEventsFilt = evalin('base','myEventsFilt'); %for filtered events
      k = slider1pos;
      Eventplot = y2(myEvents(k,1):myEvents(k,3)); %get event to be plotted
      mintemp = min(Eventplot);
      Eventplot = Eventplot - mintemp; %translate signal to origin
      if myEventsFlag(k) == 1
      plot(handles.axes1,Eventplot,'r.')
      else
      plot(handles.axes1,Eventplot,'k.') %plot in axes1
      end
      % plot(handles.axes1,myEventsFilt{k,1},'.') %for filtered events
      % Update display of text1
      set(handles.text1,'String',['Event ',num2str(k)])