|
@@ -0,0 +1,791 @@
|
|
|
+function varargout = clamp(varargin)
|
|
|
+% CLAMP MATLAB code for clamp.fig
|
|
|
+% CLAMP, by itself, creates a new CLAMP or raises the existing
|
|
|
+% singleton*.
|
|
|
+%
|
|
|
+% H = CLAMP returns the handle to a new CLAMP or the handle to
|
|
|
+% the existing singleton*.
|
|
|
+%
|
|
|
+% CLAMP('CALLBACK',hObject,eventData,handles,...) calls the local
|
|
|
+% function named CALLBACK in CLAMP.M with the given input arguments.
|
|
|
+%
|
|
|
+% CLAMP('Property','Value',...) creates a new CLAMP or raises the
|
|
|
+% existing singleton*. Starting from the left, property value pairs are
|
|
|
+% applied to the GUI before clamp_OpeningFcn gets called. An
|
|
|
+% unrecognized property name or invalid value makes property application
|
|
|
+% stop. All inputs are passed to clamp_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 clamp
|
|
|
+
|
|
|
+% Last Modified by GUIDE v2.5 01-Aug-2018 17:00:38
|
|
|
+
|
|
|
+% Begin initialization code - DO NOT EDIT
|
|
|
+gui_Singleton = 1;
|
|
|
+gui_State = struct('gui_Name', mfilename, ...
|
|
|
+ 'gui_Singleton', gui_Singleton, ...
|
|
|
+ 'gui_OpeningFcn', @clamp_OpeningFcn, ...
|
|
|
+ 'gui_OutputFcn', @clamp_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 clamp is made visible.
|
|
|
+function clamp_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 clamp (see VARARGIN)
|
|
|
+
|
|
|
+% Update the current L&F
|
|
|
+%originalLnF = javax.swing.UIManager.getLookAndFeel; %class
|
|
|
+%newLnF = 'javax.swing.plaf.metal.MetalLookAndFeel'; %string
|
|
|
+%javax.swing.UIManager.setLookAndFeel(newLnF);
|
|
|
+
|
|
|
+% Restore the original L&F
|
|
|
+%javax.swing.UIManager.setLookAndFeel(originalLnF);
|
|
|
+
|
|
|
+%Create a data acquisition session
|
|
|
+handles.devices = daq.getDevices;
|
|
|
+handles.daqSession = daq.createSession('ni');
|
|
|
+
|
|
|
+% Add channels specified by subsystem type and device
|
|
|
+chAI0=addAnalogInputChannel(handles.daqSession,'Dev1', 0, 'Voltage');
|
|
|
+chAI0.TerminalConfig = 'SingleEndedNonReferenced';
|
|
|
+chAI1=addAnalogInputChannel(handles.daqSession,'Dev1', 1, 'Voltage');
|
|
|
+chAI1.TerminalConfig = 'SingleEndedNonReferenced';
|
|
|
+chAO0=addAnalogOutputChannel(handles.daqSession,'Dev1', 0, 'Voltage');
|
|
|
+
|
|
|
+% Configure Data Acquisition Properties
|
|
|
+handles.daqSession.Rate = 100000;
|
|
|
+handles.secToAccuire=1;%Sample period in seconds
|
|
|
+handles.vHold=-100;
|
|
|
+handles.scaleFactorI=0.1; %0.1 V per uA
|
|
|
+handles.scaleFactorV=10; %V output scaled 10x on OC-725C
|
|
|
+handles.mVconversion=1000; %To mV
|
|
|
+handles.mSconversion=1000; %To mS
|
|
|
+handles.msToSamples=handles.daqSession.Rate/handles.mSconversion;
|
|
|
+handles.saveData=0;
|
|
|
+handles.leakSubtraction=0;
|
|
|
+handles.PathName='C:\Users\Hugo\Documents\MATLAB';
|
|
|
+handles.FileName='clamp.mat';
|
|
|
+handles.btnStop=0;
|
|
|
+
|
|
|
+% Axis lim
|
|
|
+handles.xMin = 300;
|
|
|
+handles.xMax = 350;
|
|
|
+handles.yMinI = -5;
|
|
|
+handles.yMaxI = 0;
|
|
|
+handles.yMinV = -120;
|
|
|
+handles.yMaxV = 80;
|
|
|
+
|
|
|
+% Info
|
|
|
+handles.newCell=0;
|
|
|
+handles.human=0;
|
|
|
+handles.neandertal=0;
|
|
|
+handles.iData=[];
|
|
|
+handles.vData=[];
|
|
|
+handles.time=[];
|
|
|
+
|
|
|
+plot(handles.axes1,[],[]);
|
|
|
+xlabel(handles.axes1,'Time (ms)');
|
|
|
+ylabel(handles.axes1,'Current (uA)');
|
|
|
+axis(handles.axes1,[handles.xMin handles.xMax handles.yMinI handles.yMaxI]);
|
|
|
+
|
|
|
+plot(handles.axes2,[],[]);
|
|
|
+xlabel(handles.axes2,'Time (ms)');
|
|
|
+ylabel(handles.axes2,'Voltage (mV)');
|
|
|
+axis(handles.axes2,[handles.xMin handles.xMax handles.yMinV handles.yMaxV]);
|
|
|
+
|
|
|
+% Choose default command line output for clamp
|
|
|
+handles.output = hObject;
|
|
|
+
|
|
|
+% Update handles structure
|
|
|
+guidata(hObject, handles);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+% UIWAIT makes clamp wait for user response (see UIRESUME)
|
|
|
+% uiwait(handles.figure1);
|
|
|
+
|
|
|
+
|
|
|
+% --- Outputs from this function are returned to the command line.
|
|
|
+function varargout = clamp_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 on button press in actFastInact.
|
|
|
+function actFastInact_Callback(hObject, eventdata, handles)
|
|
|
+% hObject handle to actFastInact (see GCBO)
|
|
|
+% eventdata reserved - to be defined in a future version of MATLAB
|
|
|
+% handles structure with handles and user data (see GUIDATA)
|
|
|
+handles.btnStop=0;
|
|
|
+guidata(hObject, handles);
|
|
|
+
|
|
|
+hold(handles.axes1,'off');
|
|
|
+hold(handles.axes2,'off');
|
|
|
+
|
|
|
+holdingVoltage=handles.vHold;
|
|
|
+testPulsStart=holdingVoltage;
|
|
|
+testPulsEnd=20;
|
|
|
+testPulsInactivation=0;
|
|
|
+sleepTime=10;
|
|
|
+%Stockholmsprotokollet. 9-11 grader. Oklart vilken paus mellan?
|
|
|
+
|
|
|
+preStimulusTime=60; %ms
|
|
|
+stimulus1Time=300; %ms
|
|
|
+stimulus2Time=40; %mS
|
|
|
+postStimulusTime=120; %mS
|
|
|
+
|
|
|
+samplesToAcquire=(preStimulusTime+stimulus1Time+stimulus2Time+postStimulusTime)*handles.msToSamples;
|
|
|
+
|
|
|
+nrOfSweeps=(testPulsStart-(testPulsEnd))/-10+1;
|
|
|
+iData=zeros(samplesToAcquire,nrOfSweeps);
|
|
|
+vData=zeros(samplesToAcquire,nrOfSweeps);
|
|
|
+time=zeros(samplesToAcquire,nrOfSweeps);
|
|
|
+
|
|
|
+testPuls=testPulsStart;
|
|
|
+
|
|
|
+i=1;
|
|
|
+while testPuls<=testPulsEnd% used to be 10 steps
|
|
|
+
|
|
|
+ if i>1
|
|
|
+ pause(sleepTime);
|
|
|
+ end
|
|
|
+
|
|
|
+ drawnow() %Give the abort callback a chance to interrupt
|
|
|
+ handles = guidata(hObject); %Update the GUI data
|
|
|
+ if handles.btnStop==1 % stop condition
|
|
|
+ disp('Aborted.')
|
|
|
+ break;
|
|
|
+ end
|
|
|
+
|
|
|
+
|
|
|
+ preStimulusVoltage=holdingVoltage; %mV
|
|
|
+ preStimulus=preStimulusVoltage*ones(preStimulusTime*handles.msToSamples,1);
|
|
|
+
|
|
|
+ stimulus1Voltage=holdingVoltage+(i-1)*10; %mV
|
|
|
+ stimulus1=stimulus1Voltage*ones(stimulus1Time*handles.msToSamples,1);
|
|
|
+
|
|
|
+ stimulus2Voltage=testPulsInactivation; %mV
|
|
|
+ stimulus2=stimulus2Voltage*ones(stimulus2Time*handles.msToSamples,1);
|
|
|
+
|
|
|
+ postStimulusVoltage=holdingVoltage; %mV
|
|
|
+ postStimulus=postStimulusVoltage*ones(postStimulusTime*handles.msToSamples,1);
|
|
|
+
|
|
|
+ line0=vertcat(preStimulus,stimulus1,stimulus2,postStimulus);
|
|
|
+
|
|
|
+ queueOutputData(handles.daqSession,line0*(handles.scaleFactorV/handles.mVconversion));
|
|
|
+ [inputData,time(:,i),triggerTime] = handles.daqSession.startForeground();
|
|
|
+
|
|
|
+ iData(:,i)=(1/handles.scaleFactorI)*inputData(:,1); %data in uA
|
|
|
+ vData(:,i)=(handles.mVconversion/handles.scaleFactorV)*inputData(:,2); %data in mV
|
|
|
+
|
|
|
+ %Leak subtraction
|
|
|
+ if 1>0 %(handles.leakSubtraction==0)
|
|
|
+ iDataPlot=iData(:,i);
|
|
|
+ else
|
|
|
+ iDataPlot=iData(:,i)-mean(iData(38000:40000,i));
|
|
|
+ end
|
|
|
+
|
|
|
+ iDataPlot=movmean(iDataPlot,20);
|
|
|
+
|
|
|
+ plot(handles.axes1,handles.mSconversion*time(:,1),iDataPlot);
|
|
|
+ xlabel(handles.axes1,'Time (ms)');
|
|
|
+ ylabel(handles.axes1,'Current (uA)');
|
|
|
+ axis(handles.axes1,[handles.xMin handles.xMax handles.yMinI handles.yMaxI]);
|
|
|
+ hold(handles.axes1,'on');
|
|
|
+
|
|
|
+ plot(handles.axes2,handles.mSconversion*time(:,1),vData(:,i));
|
|
|
+ xlabel(handles.axes2,'Time (ms)');
|
|
|
+ ylabel(handles.axes2,'Voltage (mV)');
|
|
|
+ axis(handles.axes2,[handles.xMin handles.xMax handles.yMinV handles.yMaxV]);
|
|
|
+ hold(handles.axes2,'on');
|
|
|
+
|
|
|
+ disp(['Clamped ', num2str(stimulus1Voltage),' mV']);
|
|
|
+
|
|
|
+ testPuls=testPuls+10;
|
|
|
+ i=i+1;
|
|
|
+end
|
|
|
+
|
|
|
+handles.type='fast';
|
|
|
+handles.iData=iData;
|
|
|
+handles.vData=vData;
|
|
|
+handles.time=time;
|
|
|
+guidata(hObject, handles);
|
|
|
+
|
|
|
+% --- Executes on button press in slowkinetics.
|
|
|
+function slowkinetics_Callback(hObject, eventdata, handles)
|
|
|
+% hObject handle to slowkinetics (see GCBO)
|
|
|
+% eventdata reserved - to be defined in a future version of MATLAB
|
|
|
+% handles structure with handles and user data (see GUIDATA)
|
|
|
+% hObject handle to actFastInact (see GCBO)
|
|
|
+% eventdata reserved - to be defined in a future version of MATLAB
|
|
|
+% handles structure with handles and user data (see GUIDATA)
|
|
|
+
|
|
|
+hold(handles.axes1,'off');
|
|
|
+hold(handles.axes2,'off');
|
|
|
+
|
|
|
+preStimulusTime=100; %ms
|
|
|
+stimulus1Time=10000; %mS
|
|
|
+stimulus2Time=100; %mS
|
|
|
+stimulus3Time=200; %mS
|
|
|
+postStimulusTime=100; %mS
|
|
|
+
|
|
|
+holdingVoltage=-120;
|
|
|
+testPulsStart=-120;
|
|
|
+testPulsEnd=-20;
|
|
|
+sleepTime=10; %Seconds
|
|
|
+
|
|
|
+samplesToAcquire=(preStimulusTime+stimulus1Time+stimulus2Time+stimulus3Time+postStimulusTime)*handles.msToSamples;
|
|
|
+
|
|
|
+nrOfSweeps=(testPulsStart-(testPulsEnd))/-10+1;
|
|
|
+iData=zeros(samplesToAcquire,nrOfSweeps);
|
|
|
+vData=zeros(samplesToAcquire,nrOfSweeps);
|
|
|
+time=zeros(samplesToAcquire,nrOfSweeps);
|
|
|
+
|
|
|
+testPuls=testPulsStart;
|
|
|
+i=1;
|
|
|
+while testPuls<=testPulsEnd% used to be 10 steps
|
|
|
+
|
|
|
+ if i>1
|
|
|
+ pause(sleepTime);
|
|
|
+ end
|
|
|
+
|
|
|
+ preStimulusVoltage=holdingVoltage; %mV %Used to be minus 120
|
|
|
+ preStimulus=preStimulusVoltage*ones(preStimulusTime*handles.msToSamples,1);
|
|
|
+
|
|
|
+ stimulus1Voltage=testPuls; %mV %Used to be minus 140 * 10
|
|
|
+ stimulus1=stimulus1Voltage*ones(stimulus1Time*handles.msToSamples,1);
|
|
|
+
|
|
|
+ stimulus2Voltage=holdingVoltage; %mV %Used to be minus 120
|
|
|
+ stimulus2=stimulus2Voltage*ones(stimulus2Time*handles.msToSamples,1);
|
|
|
+
|
|
|
+ stimulus3Voltage=0; %mV
|
|
|
+ stimulus3=stimulus3Voltage*ones(stimulus3Time*handles.msToSamples,1);
|
|
|
+
|
|
|
+ postStimulusVoltage=holdingVoltage; %mV
|
|
|
+ postStimulus=postStimulusVoltage*ones(postStimulusTime*handles.msToSamples,1);
|
|
|
+
|
|
|
+ line0=vertcat(preStimulus,stimulus1,stimulus2,stimulus3,postStimulus);
|
|
|
+
|
|
|
+ queueOutputData(handles.daqSession,line0*(handles.scaleFactorV/handles.mVconversion));
|
|
|
+ [inputData,time(:,i),triggerTime] = handles.daqSession.startForeground();
|
|
|
+
|
|
|
+ iData(:,i)=(1/handles.scaleFactorI)*inputData(:,1); %data in uA
|
|
|
+ vData(:,i)=(handles.mVconversion/handles.scaleFactorV)*inputData(:,2); %data in mV
|
|
|
+
|
|
|
+ %Leak subtraction
|
|
|
+ if 1<0%(handles.leakSubtraction==0)
|
|
|
+ iDataPlot=iData(:,i);
|
|
|
+ else
|
|
|
+ iDataPlot=iData(:,i)-max(iData((preStimulusTime+stimulus1Time+stimulus2Time+0.5*stimulus3Time:preStimulusTime+stimulus1Time+stimulus2Time+stimulus3Time)*handles.msToSamples,i));
|
|
|
+ end
|
|
|
+
|
|
|
+ iDataPlot=movmean(iDataPlot,20);
|
|
|
+
|
|
|
+ plot(handles.axes1,handles.mSconversion*time(:,1),iDataPlot);
|
|
|
+ xlabel(handles.axes1,'Time (ms)');
|
|
|
+ ylabel(handles.axes1,'Current (uA)');
|
|
|
+ axis(handles.axes1,[handles.xMin handles.xMax handles.yMinI handles.yMaxI]);
|
|
|
+ hold(handles.axes1,'on');
|
|
|
+
|
|
|
+ plot(handles.axes2,handles.mSconversion*time(:,1),vData(:,i));
|
|
|
+ xlabel(handles.axes2,'Time (ms)');
|
|
|
+ ylabel(handles.axes2,'Voltage (mV)');
|
|
|
+ axis(handles.axes2,[handles.xMin handles.xMax handles.yMinV handles.yMaxV]);
|
|
|
+ hold(handles.axes2,'on');
|
|
|
+
|
|
|
+ disp(['Clamped ', num2str(stimulus1Voltage),' mV']);
|
|
|
+
|
|
|
+ testPuls=testPuls+10;
|
|
|
+ i=i+1;
|
|
|
+end
|
|
|
+
|
|
|
+handles.type='slow';
|
|
|
+handles.iData=iData;
|
|
|
+handles.vData=vData;
|
|
|
+handles.time=time;
|
|
|
+guidata(hObject, handles);
|
|
|
+
|
|
|
+% --- Executes on button press in resurgent.
|
|
|
+function resurgent_Callback(hObject, eventdata, handles)
|
|
|
+% hObject handle to resurgent (see GCBO)
|
|
|
+% eventdata reserved - to be defined in a future version of MATLAB
|
|
|
+% handles structure with handles and user data (see GUIDATA)
|
|
|
+hold(handles.axes1,'off');
|
|
|
+hold(handles.axes2,'off');
|
|
|
+
|
|
|
+preStimulusTime=100; %ms
|
|
|
+stimulus1Time=20; %ms
|
|
|
+stimulus2Time=500; %mS
|
|
|
+postStimulusTime=100; %mS
|
|
|
+
|
|
|
+samplesToAcquire=(preStimulusTime+stimulus1Time+stimulus2Time+postStimulusTime)*handles.msToSamples;
|
|
|
+
|
|
|
+iData=zeros(samplesToAcquire,11);
|
|
|
+vData=zeros(samplesToAcquire,11);
|
|
|
+time=zeros(samplesToAcquire,11);
|
|
|
+
|
|
|
+for i=1:1%11
|
|
|
+
|
|
|
+ preStimulusVoltage=-100; %mV
|
|
|
+ preStimulus=preStimulusVoltage*ones(preStimulusTime*handles.msToSamples,1);
|
|
|
+
|
|
|
+ stimulus1Voltage=30; %mV
|
|
|
+ stimulus1=stimulus1Voltage*ones(stimulus1Time*handles.msToSamples,1);
|
|
|
+
|
|
|
+ stimulus2Voltage=-80+(i-1)*10; %mV
|
|
|
+ stimulus2=stimulus2Voltage*ones(stimulus2Time*handles.msToSamples,1);
|
|
|
+
|
|
|
+ postStimulusVoltage=-100; %mV
|
|
|
+ postStimulus=postStimulusVoltage*ones(postStimulusTime*handles.msToSamples,1);
|
|
|
+
|
|
|
+ line0=vertcat(preStimulus,stimulus1,stimulus2,postStimulus);
|
|
|
+
|
|
|
+ queueOutputData(handles.daqSession,line0*(handles.scaleFactorV/handles.mVconversion));
|
|
|
+ [inputData,time(:,i),triggerTime] = handles.daqSession.startForeground();
|
|
|
+
|
|
|
+ iData(:,i)=(1/handles.scaleFactorI)*inputData(:,1); %data in uA
|
|
|
+ vData(:,i)=(handles.mVconversion/handles.scaleFactorV)*inputData(:,2); %data in mV
|
|
|
+
|
|
|
+ %Leak subtraction
|
|
|
+ if(handles.leakSubtraction==0)
|
|
|
+ iDataPlot=iData(:,i);
|
|
|
+ else
|
|
|
+ iDataPlot=iData(:,i)-mean(iData(500*handles.msToSamples:600*handles.msToSamples,i));
|
|
|
+ end
|
|
|
+
|
|
|
+ iDataPlot=movmean(iDataPlot,200);
|
|
|
+
|
|
|
+ plot(handles.axes1,handles.mSconversion*time(:,1),iDataPlot);
|
|
|
+ xlabel(handles.axes1,'Time (ms)');
|
|
|
+ ylabel(handles.axes1,'Current (uA)');
|
|
|
+ axis(handles.axes1,[handles.xMin handles.xMax handles.yMinI handles.yMaxI]);
|
|
|
+ hold(handles.axes1,'on');
|
|
|
+
|
|
|
+ plot(handles.axes2,handles.mSconversion*time(:,1),vData(:,i));
|
|
|
+ xlabel(handles.axes2,'Time (ms)');
|
|
|
+ ylabel(handles.axes2,'Voltage (mV)');
|
|
|
+ axis(handles.axes2,[handles.xMin handles.xMax handles.yMinV handles.yMaxV]);
|
|
|
+ hold(handles.axes2,'on');
|
|
|
+
|
|
|
+ disp(['Clamped ', num2str(stimulus2Voltage),' mV']);
|
|
|
+ pause(2.5);
|
|
|
+end
|
|
|
+
|
|
|
+handles.type='resurgent';
|
|
|
+handles.iData=iData;
|
|
|
+handles.vData=vData;
|
|
|
+handles.time=time;
|
|
|
+guidata(hObject, handles);
|
|
|
+
|
|
|
+% --- Executes on button press in pushbutton2.
|
|
|
+function pushbutton2_Callback(hObject, eventdata, handles)
|
|
|
+% hObject handle to pushbutton2 (see GCBO)
|
|
|
+% eventdata reserved - to be defined in a future version of MATLAB
|
|
|
+% handles structure with handles and user data (see GUIDATA)
|
|
|
+% Run Session & Acquire Data
|
|
|
+%line0=vertcat(ones(handles.daqSession.Rate*1,1), ones(handles.daqSession.Rate*0,1));
|
|
|
+
|
|
|
+handles.vHold = str2double(get(handles.edit1,'String'));
|
|
|
+line0=handles.vHold*ones(handles.daqSession.Rate,1);
|
|
|
+
|
|
|
+%vHold = str2double(get(handles.edit1,'String'));
|
|
|
+%line0=vHold*ones(handles.daqSession.Rate,1);
|
|
|
+
|
|
|
+queueOutputData(handles.daqSession,line0*(handles.scaleFactorV/handles.mVconversion));
|
|
|
+[data,time,triggerTime] = handles.daqSession.startForeground();
|
|
|
+guidata(hObject, handles);
|
|
|
+
|
|
|
+
|
|
|
+% --- Executes on button press in save.
|
|
|
+function save_Callback(hObject, eventdata, handles)
|
|
|
+% hObject handle to save (see GCBO)
|
|
|
+% eventdata reserved - to be defined in a future version of MATLAB
|
|
|
+% handles structure with handles and user data (see GUIDATA)
|
|
|
+%'iData','vData','time',
|
|
|
+
|
|
|
+iData=handles.iData;
|
|
|
+vData=handles.vData;
|
|
|
+time=handles.time;
|
|
|
+newCell=handles.newCell;
|
|
|
+human=handles.human;
|
|
|
+neandertal=handles.neandertal;
|
|
|
+%type=handles.type;
|
|
|
+temp=str2double(get(handles.temp,'String'));
|
|
|
+conc=str2double(get(handles.conc,'String'));
|
|
|
+days=str2double(get(handles.days,'String'));
|
|
|
+fileNr=length(dir('*.mat'))+1;
|
|
|
+
|
|
|
+if newCell==1
|
|
|
+ str='_newcell';
|
|
|
+else
|
|
|
+ str='';
|
|
|
+end
|
|
|
+
|
|
|
+if human==1
|
|
|
+ save(strcat(date,'_',num2str(fileNr),'_human',str),'human','neandertal','iData','vData','time','days','conc','temp');
|
|
|
+ disp('Data saved.')
|
|
|
+elseif neandertal==1
|
|
|
+ save(strcat(date,'_',num2str(fileNr),'_neandertal_M932L',str),'human','neandertal','iData','vData','time','days','conc','temp');
|
|
|
+ disp('Data saved.')
|
|
|
+else
|
|
|
+ disp('No species set. Data could not be saved.')
|
|
|
+end
|
|
|
+
|
|
|
+
|
|
|
+% --- Executes on button press in newcell.
|
|
|
+function newcell_Callback(hObject, eventdata, handles)
|
|
|
+% hObject handle to newcell (see GCBO)
|
|
|
+% eventdata reserved - to be defined in a future version of MATLAB
|
|
|
+% handles structure with handles and user data (see GUIDATA)
|
|
|
+if (get(hObject,'Value') == get(hObject,'Max'))
|
|
|
+ handles.newCell=1;
|
|
|
+else
|
|
|
+ handles.newCell=0;
|
|
|
+end
|
|
|
+% Update handles structure
|
|
|
+guidata(hObject, handles);
|
|
|
+
|
|
|
+% --- Executes on button press in pushbutton3.
|
|
|
+function pushbutton3_Callback(hObject, eventdata, handles)
|
|
|
+% hObject handle to pushbutton3 (see GCBO)
|
|
|
+% eventdata reserved - to be defined in a future version of MATLAB
|
|
|
+% handles structure with handles and user data (see GUIDATA)
|
|
|
+
|
|
|
+[handles.FileName,handles.PathName] = uiputfile('*.mat','Save data to');
|
|
|
+% Update handles structure
|
|
|
+guidata(hObject, handles);
|
|
|
+
|
|
|
+
|
|
|
+function edit1_Callback(hObject, eventdata, handles)
|
|
|
+% hObject handle to edit1 (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 edit1 as text
|
|
|
+% str2double(get(hObject,'String')) returns contents of edit1 as a double
|
|
|
+
|
|
|
+
|
|
|
+% --- Executes during object creation, after setting all properties.
|
|
|
+function edit1_CreateFcn(hObject, eventdata, handles)
|
|
|
+% hObject handle to edit1 (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 xminset_Callback(hObject, eventdata, handles)
|
|
|
+% hObject handle to xminset (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 xminset as text
|
|
|
+% str2double(get(hObject,'String')) returns contents of xminset as a double
|
|
|
+
|
|
|
+
|
|
|
+% --- Executes during object creation, after setting all properties.
|
|
|
+function xminset_CreateFcn(hObject, eventdata, handles)
|
|
|
+% hObject handle to xminset (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 setaxes.
|
|
|
+function setaxes_Callback(hObject, eventdata, handles)
|
|
|
+% hObject handle to setaxes (see GCBO)
|
|
|
+% eventdata reserved - to be defined in a future version of MATLAB
|
|
|
+% handles structure with handles and user data (see GUIDATA)
|
|
|
+axis(handles.axes1,[str2double(get(handles.xminset,'String')) str2double(get(handles.xmaxset,'String')) str2double(get(handles.yminset,'String')) str2double(get(handles.ymaxset,'String'))]);
|
|
|
+handles.xMin = str2double(get(handles.xminset,'String'));
|
|
|
+handles.xMax = str2double(get(handles.xmaxset,'String'));
|
|
|
+handles.yMinI = str2double(get(handles.yminset,'String'));
|
|
|
+handles.yMaxI = str2double(get(handles.ymaxset,'String'));
|
|
|
+handles.yMinV = -120;
|
|
|
+handles.yMaxV = 80;
|
|
|
+guidata(hObject, handles);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+function xmaxset_Callback(hObject, eventdata, handles)
|
|
|
+% hObject handle to xmaxset (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 xmaxset as text
|
|
|
+% str2double(get(hObject,'String')) returns contents of xmaxset as a double
|
|
|
+
|
|
|
+
|
|
|
+% --- Executes during object creation, after setting all properties.
|
|
|
+function xmaxset_CreateFcn(hObject, eventdata, handles)
|
|
|
+% hObject handle to xmaxset (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 yminset_Callback(hObject, eventdata, handles)
|
|
|
+% hObject handle to yminset (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 yminset as text
|
|
|
+% str2double(get(hObject,'String')) returns contents of yminset as a double
|
|
|
+
|
|
|
+
|
|
|
+% --- Executes during object creation, after setting all properties.
|
|
|
+function yminset_CreateFcn(hObject, eventdata, handles)
|
|
|
+% hObject handle to yminset (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 ymaxset_Callback(hObject, eventdata, handles)
|
|
|
+% hObject handle to ymaxset (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 ymaxset as text
|
|
|
+% str2double(get(hObject,'String')) returns contents of ymaxset as a double
|
|
|
+
|
|
|
+
|
|
|
+% --- Executes during object creation, after setting all properties.
|
|
|
+function ymaxset_CreateFcn(hObject, eventdata, handles)
|
|
|
+% hObject handle to ymaxset (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 checkbox5_Callback(hObject, eventdata, handles)
|
|
|
+% hObject handle to save (see GCBO)
|
|
|
+% eventdata reserved - to be defined in a future version of MATLAB
|
|
|
+% handles structure with handles and user data (see GUIDATA)
|
|
|
+
|
|
|
+% Hint: get(hObject,'Value') returns toggle state of save
|
|
|
+
|
|
|
+if (get(hObject,'Value') == get(hObject,'Max'))
|
|
|
+ handles.leakSubtraction=1;
|
|
|
+else
|
|
|
+ handles.leakSubtraction=0;
|
|
|
+end
|
|
|
+% Update handles structure
|
|
|
+guidata(hObject, handles);
|
|
|
+
|
|
|
+
|
|
|
+% --- 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)
|
|
|
+handles.sweep=9999;
|
|
|
+%Update handles structure
|
|
|
+guidata(hObject, handles);
|
|
|
+
|
|
|
+
|
|
|
+% --- Executes on button press in human.
|
|
|
+function human_Callback(hObject, eventdata, handles)
|
|
|
+% hObject handle to human (see GCBO)
|
|
|
+% eventdata reserved - to be defined in a future version of MATLAB
|
|
|
+% handles structure with handles and user data (see GUIDATA)
|
|
|
+if (get(hObject,'Value') == get(hObject,'Max'))
|
|
|
+ handles.human=1;
|
|
|
+else
|
|
|
+ handles.human=0;
|
|
|
+end
|
|
|
+% Update handles structure
|
|
|
+guidata(hObject, handles);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+% --- Executes on button press in neandertal.
|
|
|
+function neandertal_Callback(hObject, eventdata, handles)
|
|
|
+% hObject handle to neandertal (see GCBO)
|
|
|
+% eventdata reserved - to be defined in a future version of MATLAB
|
|
|
+% handles structure with handles and user data (see GUIDATA)
|
|
|
+if (get(hObject,'Value') == get(hObject,'Max'))
|
|
|
+ handles.neandertal=1;
|
|
|
+else
|
|
|
+ handles.neandertal=0;
|
|
|
+end
|
|
|
+% Update handles structure
|
|
|
+guidata(hObject, handles);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+function days_Callback(hObject, eventdata, handles)
|
|
|
+% hObject handle to days (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 days as text
|
|
|
+% str2double(get(hObject,'String')) returns contents of days as a double
|
|
|
+
|
|
|
+
|
|
|
+% --- Executes during object creation, after setting all properties.
|
|
|
+function days_CreateFcn(hObject, eventdata, handles)
|
|
|
+% hObject handle to days (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 conc_Callback(hObject, eventdata, handles)
|
|
|
+% hObject handle to conc (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 conc as text
|
|
|
+% str2double(get(hObject,'String')) returns contents of conc as a double
|
|
|
+
|
|
|
+
|
|
|
+% --- Executes during object creation, after setting all properties.
|
|
|
+function conc_CreateFcn(hObject, eventdata, handles)
|
|
|
+% hObject handle to conc (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 temp_Callback(hObject, eventdata, handles)
|
|
|
+% hObject handle to temp (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 temp as text
|
|
|
+% str2double(get(hObject,'String')) returns contents of temp as a double
|
|
|
+
|
|
|
+
|
|
|
+% --- Executes during object creation, after setting all properties.
|
|
|
+function temp_CreateFcn(hObject, eventdata, handles)
|
|
|
+% hObject handle to temp (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 checkbox9.
|
|
|
+function checkbox9_Callback(hObject, eventdata, handles)
|
|
|
+% hObject handle to checkbox9 (see GCBO)
|
|
|
+% eventdata reserved - to be defined in a future version of MATLAB
|
|
|
+% handles structure with handles and user data (see GUIDATA)
|
|
|
+
|
|
|
+% Hint: get(hObject,'Value') returns toggle state of checkbox9
|
|
|
+
|
|
|
+
|
|
|
+% --- 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)
|
|
|
+
|
|
|
+preStimulusTime=100; %ms
|
|
|
+stimulus1Time=100; %ms
|
|
|
+postStimulusTime=100; %mS
|
|
|
+
|
|
|
+samplesToAcquire=(preStimulusTime+stimulus1Time+postStimulusTime)*handles.msToSamples;
|
|
|
+
|
|
|
+nrOfSweeps=1;
|
|
|
+iData=zeros(samplesToAcquire,nrOfSweeps);
|
|
|
+vData=zeros(samplesToAcquire,nrOfSweeps);
|
|
|
+time=zeros(samplesToAcquire,nrOfSweeps);
|
|
|
+
|
|
|
+for i=1:nrOfSweeps
|
|
|
+ preStimulusVoltage=handles.vHold; %mV
|
|
|
+ preStimulus=preStimulusVoltage*ones(preStimulusTime*handles.msToSamples,1);
|
|
|
+
|
|
|
+ stimulus1Voltage=handles.vHold+10; %mV
|
|
|
+ stimulus1=stimulus1Voltage*ones(stimulus1Time*handles.msToSamples,1);
|
|
|
+
|
|
|
+ postStimulusVoltage=handles.vHold; %mV
|
|
|
+ postStimulus=postStimulusVoltage*ones(postStimulusTime*handles.msToSamples,1);
|
|
|
+
|
|
|
+ line0=vertcat(preStimulus,stimulus1,postStimulus);
|
|
|
+
|
|
|
+ queueOutputData(handles.daqSession,line0*(handles.scaleFactorV/handles.mVconversion));
|
|
|
+ [inputData,time(:,i),triggerTime] = handles.daqSession.startForeground();
|
|
|
+
|
|
|
+ iData(:,i)=(1/handles.scaleFactorI)*inputData(:,1); %data in uA
|
|
|
+ vData(:,i)=(handles.mVconversion/handles.scaleFactorV)*inputData(:,2); %data in mV
|
|
|
+end
|
|
|
+
|
|
|
+disp(['Membrane resistance is ', num2str(0.01/(mean(iData(150*handles.msToSamples:200*handles.msToSamples,1))-mean(iData(1*handles.msToSamples:50*handles.msToSamples,1)))),' MOhm at ', num2str(handles.vHold), 'mV' ]);
|
|
|
+
|
|
|
+
|
|
|
+% --- 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)
|
|
|
+handles.btnStop=1;
|
|
|
+guidata(hObject, handles);
|