function varargout = run_example(varargin)
% run_example M-file for run_example.fig
% run_example, by itself, creates a new run_example or raises the existing
% singleton*.
%
% H = run_example returns the handle to a new run_example or the handle to
% the existing singleton*.
%
% run_example('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in run_example.M with the given input arguments.
%
% run_example('Property','Value',...) creates a new run_example or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before run_example_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to run_example_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE 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 run_example
% Last Modified by GUIDE v2.5 03-Aug-2009 17:45:35
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @run_example_OpeningFcn, ...
'gui_OutputFcn', @run_example_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 run_example is made visible.
function run_example_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 run_example (see VARARGIN)
% Choose default command line output for run_example
handles.output = hObject;
% make all handle properties available
set(0,'HideUndocumented','off');
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes run_example wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = run_example_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;
%======================================================================
%----------------------------------------------------------------------
% Create panel which contains input table, etc.
%----------------------------------------------------------------------
%
% --- Executes during object creation, after setting all properties.
function uipanel_main_CreateFcn(hObject, eventdata, handles)
% hObject handle to uipanel_main (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
%----------------------------------------------------------------------
% Create panel which will contain plots
%----------------------------------------------------------------------
%
% --- Executes during object creation, after setting all properties.
function plot_panel_CreateFcn(hObject, eventdata, handles)
% hObject handle to plot_panel (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
handles.plot_panel = hObject;
guidata(hObject,handles);
%----------------------------------------------------------------------
% Text at top of window briefly explaining how to run
%----------------------------------------------------------------------
%
% --- Executes during object creation, after setting all properties.
function how_to_run_CreateFcn(hObject, eventdata, handles)
% hObject handle to how_to_run (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
%####################################################
mystring = ['EPSP and IPSP presynatpic inputs:' char(10) ...
'Select the number of inputs spread evenly over a 50 msec span'];
%####################################################
set(hObject,'String',mystring);
%----------------------------------------------------------------------
% Input value table help button
%----------------------------------------------------------------------
%
% --- Executes on button press in pushbutton_help.
function pushbutton_help_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton_help (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%#############################################################
helpstring = 'First part of help string ';
helpstring = [helpstring 'Second part of help string. '];
%#############################################################
helpdlg(helpstring,'How to Run');
%----------------------------------------------------------------------
% Run Button
%----------------------------------------------------------------------
%
% --- Executes on button press in pushbutton_run.
function pushbutton_run_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton_run (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% handles.xcomp is a vector containing the results of the
% Complement_Code run. The first half of the vector contains
% the normalized (or truncated) feature values, and the
% second half of the vector contains their complements.
%############################################################
eVal=zeros(1,3);
iVal=zeros(1,3);
eVal(1)=str2num(get(handles.epsp_edit,'String'));
iVal(1)=str2num(get(handles.ipsp_edit,'String'));
eVal(2)=str2num(get(handles.epsp_rise,'String'));
iVal(2)=str2num(get(handles.ipsp_rise,'String'));
eVal(3)=str2num(get(handles.epsp_fall,'String'));
iVal(3)=str2num(get(handles.ipsp_fall,'String'));
eVal(4)=str2num(get(handles.epsp_w,'String'));
iVal(4)=str2num(get(handles.ipsp_w,'String'));
[tv, epsp_d, ipsp_d, spike_d] = epsp_ipsp(eVal,iVal);
%% plot epsp
hplot = subplot(3,1,1,'Parent',handles.plot_panel);
plot(hplot,tv,epsp_d);
htitle=title('EPSP Current');
hyl1 = ylabel('Volatage');
set(hplot,'ylim',[0,6]);
set(htitle,'FontWeight','bold');
%% plot ipsp
hplot = subplot(3,1,2,'Parent',handles.plot_panel);
plot(hplot,tv,ipsp_d);
htitle=title('IPSP Current');
hyl1 = ylabel('Volatage');
set(hplot,'ylim',[-6,0]);
set(htitle,'FontWeight','bold');
%% Plot spike train
hplot = subplot(3,1,3,'Parent',handles.plot_panel);
plot(hplot,tv,spike_d);
htitle=title('Spike Train');
hxl1 = xlabel('mSec');
hyl1 = ylabel('Volatage');
set(hplot,'ylim',[-100,100]);
%set(hyl1,'Rotation',0);
set(htitle,'FontWeight','bold');
%############################################################
guidata(hObject,handles);
%----------------------------------------------------------------------
% Close Button
%----------------------------------------------------------------------
%
% --- Executes on button press in close_button.
function close_button_Callback(hObject, eventdata, handles)
% hObject handle to close_button (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
close
% --- Executes on slider movement.
function epsp_slider_Callback(hObject, eventdata, handles)
% hObject handle to epsp_slider (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
mn=get(hObject,'Min');
mn=0;
mx=get(hObject,'Max');
mx=10;
v=round(get(hObject,'Value'));
set(handles.epsp_edit,'String',num2str(v));
% --- Executes during object creation, after setting all properties.
function epsp_slider_CreateFcn(hObject, eventdata, handles)
% hObject handle to epsp_slider (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
set(hObject,'Value',4);
function ipsp_edit_Callback(hObject, eventdata, handles)
% hObject handle to ipsp_edit (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 ipsp_edit as text
% str2double(get(hObject,'String')) returns contents of ipsp_edit as a double
v=str2num(get(hObject,'String'));
v=max(v,0);
v=min(v,10);
set(hObject,'String',num2str(v))
% --- Executes during object creation, after setting all properties.
function ipsp_edit_CreateFcn(hObject, eventdata, handles)
% hObject handle to ipsp_edit (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
set(hObject,'String',2);
function epsp_edit_Callback(hObject, eventdata, handles)
% hObject handle to epsp_edit (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 epsp_edit as text
% str2double(get(hObject,'String')) returns contents of epsp_edit as a double
v=str2num(get(hObject,'String'));
v=max(v,0);
v=min(v,10);
set(hObject,'String',num2str(v))
% --- Executes during object creation, after setting all properties.
function epsp_edit_CreateFcn(hObject, eventdata, handles)
% hObject handle to epsp_edit (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
set(hObject,'String',4);
% --- Executes on slider movement.
function ipsp_slider_Callback(hObject, eventdata, handles)
% hObject handle to ipsp_slider (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
mn=get(hObject,'Min');
mn=0;
mx=get(hObject,'Max');
mx=10;
v=round(get(hObject,'Value'));
set(handles.ipsp_edit,'String',num2str(v));
% --- Executes during object creation, after setting all properties.
function ipsp_slider_CreateFcn(hObject, eventdata, handles)
% hObject handle to ipsp_slider (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
set(hObject,'Value',2);
function epsp_rise_Callback(hObject, eventdata, handles)
% hObject handle to epsp_rise (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 epsp_rise as text
% str2double(get(hObject,'String')) returns contents of epsp_rise as a double
% --- Executes during object creation, after setting all properties.
function epsp_rise_CreateFcn(hObject, eventdata, handles)
% hObject handle to epsp_rise (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
set(hObject,'String',2);
function ipsp_rise_Callback(hObject, eventdata, handles)
% hObject handle to ipsp_rise (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 ipsp_rise as text
% str2double(get(hObject,'String')) returns contents of ipsp_rise as a double
% --- Executes during object creation, after setting all properties.
function ipsp_rise_CreateFcn(hObject, eventdata, handles)
% hObject handle to ipsp_rise (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
set(hObject,'String',2);
function epsp_fall_Callback(hObject, eventdata, handles)
% hObject handle to epsp_fall (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 epsp_fall as text
% str2double(get(hObject,'String')) returns contents of epsp_fall as a double
% --- Executes during object creation, after setting all properties.
function epsp_fall_CreateFcn(hObject, eventdata, handles)
% hObject handle to epsp_fall (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
set(hObject,'String',3);
function ipsp_fall_Callback(hObject, eventdata, handles)
% hObject handle to ipsp_fall (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 ipsp_fall as text
% str2double(get(hObject,'String')) returns contents of ipsp_fall as a double
% --- Executes during object creation, after setting all properties.
function ipsp_fall_CreateFcn(hObject, eventdata, handles)
% hObject handle to ipsp_fall (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
set(hObject,'String',3);
function ipsp_w_Callback(hObject, eventdata, handles)
% hObject handle to ipsp_w (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 ipsp_w as text
% str2double(get(hObject,'String')) returns contents of ipsp_w as a double
v=str2num(get(hObject,'String'));
v=max(v,0);
v=min(v,15);
set(hObject,'String',num2str(v))
% --- Executes during object creation, after setting all properties.
function ipsp_w_CreateFcn(hObject, eventdata, handles)
% hObject handle to ipsp_w (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
set(hObject,'String',10);
function epsp_w_Callback(hObject, eventdata, handles)
% hObject handle to epsp_w (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 epsp_w as text
% str2double(get(hObject,'String')) returns contents of epsp_w as a double
v=str2num(get(hObject,'String'));
v=max(v,0);
v=min(v,15);
set(hObject,'String',num2str(v))
% --- Executes during object creation, after setting all properties.
function epsp_w_CreateFcn(hObject, eventdata, handles)
% hObject handle to epsp_w (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
set(hObject,'String',5);