|
102 | 102 | % Grab stimuli based on velocityStim (second output from IdAnalysis) |
103 | 103 | % Just example stim from one trace |
104 | 104 | % Should this be photodiode trace? (if so don't forget to zero it) |
105 | | -stimTrace{1} = ephysData.FAT214.data{3,18}(:,2); |
106 | | -stimTrace{2} = ephysData.FAT214.data{3,11}(:,2); |
107 | | -stimTrace{3} = ephysData.FAT214.data{3,12}(:,3); |
108 | | -stimTrace{4} = ephysData.FAT214.data{3,12}(:,4); |
109 | | -stimTrace{5} = ephysData.FAT214.data{3,11}(:,3); |
110 | | - |
| 105 | +stimTrace = cell(0); |
| 106 | +stimTrace{1} = ephysData.FAT214.data{2,18}(:,2); |
| 107 | +stimTrace{2} = ephysData.FAT214.data{2,11}(:,2); |
| 108 | +stimTrace{3} = ephysData.FAT214.data{2,12}(:,3); |
| 109 | +stimTrace{4} = ephysData.FAT214.data{2,12}(:,4); |
| 110 | +stimTrace{5} = ephysData.FAT214.data{2,17}(:,5); |
| 111 | + |
| 112 | +%pad to same length |
| 113 | +sweepLengths = cellfun('length',stimTrace); |
| 114 | +maxLength = max(sweepLengths); |
| 115 | +stimTrace = cellfun(@(x)cat(1,x,NaN(maxLength-length(x),1)),stimTrace,'UniformOutput',false); |
| 116 | +stimTrace = cell2mat(stimTrace); |
| 117 | +stimZero = mean(stimTrace(1:100,:),1); |
| 118 | +stimTrace = stimTrace - repmat(stimZero,[10000 1]); |
| 119 | +stimTrace = stimTrace/0.408; |
| 120 | +tVec = (1:length(velocityMRCs{1,2}))/10; % time in ms |
111 | 121 |
|
112 | 122 |
|
113 | 123 | figure(); |
114 | 124 | axh(1)=subplot(2,1,1); |
115 | 125 | for i = 1:5 |
116 | | - plot(stimTrace{i}) |
117 | | - hold on |
| 126 | +plot(tVec,stimTrace); |
118 | 127 | end |
119 | | -tVec = (1:length(velocityMRCs{1,2}))/10; % time in ms |
| 128 | +cmapline('ax',gca,'colormap','copper'); |
| 129 | +chH = get(gca,'children'); |
| 130 | +set(gca,'children',flipud(chH)); |
| 131 | + |
| 132 | +axh(2)=subplot(2,1,2); |
120 | 133 | plot(tVec,velocityMRCs{1,2}([2 5 6 10 12],:)'); |
| 134 | +linkaxes(axh,'x'); |
121 | 135 | cmapline('ax',gca,'colormap','copper'); |
122 | 136 | chH = get(gca,'children'); |
123 | 137 | set(gca,'children',flipud(chH)); |
| 138 | +ylim([-10e-11 1e-11]); |
124 | 139 | plotfixer(); |
125 | 140 |
|
126 | | -%% Pull out and combine relevant data for plot |
| 141 | +%% Pull out and combine data to plot one particular velocity vs. distance |
127 | 142 |
|
128 | 143 | % Voltage attenuation data comes from the length constant fitting done in |
129 | 144 | % Igor, which gives a voltage attenuation factor at the location of the |
|
192 | 207 |
|
193 | 208 | clear a iCell thisCell whichMRCs whichStep thisName hasAtt distVPeak |
194 | 209 |
|
195 | | -%% Make correction to I for space clamp error |
| 210 | +%% Make correction to I for space clamp error for one particular velocity |
196 | 211 | % (Note: this is an approximation, assuming that the majority of the |
197 | 212 | % current is happening at the stimulus site, which we know is not entirely |
198 | 213 | % true, and channels at different points along the neurite will experience |
|
226 | 241 | distVPeak_Off(:,4) = (Im * (Vc-Ena)) ./ (Vm-Ena); |
227 | 242 |
|
228 | 243 |
|
229 | | -%% Plot on and off currents vs distance |
| 244 | +%% Plot on and off currents vs distance for one velocity |
230 | 245 |
|
231 | 246 | figure(); |
232 | 247 | scatter(distVPeak_On(:,1),distVPeak_On(:,4),'b'); |
|
239 | 254 | legend({'On current','Off current'}); |
240 | 255 |
|
241 | 256 |
|
242 | | -%% Correct all sizes and export for Igor fitting of Boltzmann to each recording |
| 257 | +%% Correct all velocities and export for Igor fitting of Boltzmann to each recording |
243 | 258 |
|
244 | 259 | % Set the filename |
245 | | -fname = 'PatchData/attCorrectedVel_times(181002).xls'; |
| 260 | +fname = 'PatchData/attCorrectedVel(181004).xls'; |
246 | 261 | noCorr = 0; |
247 | 262 |
|
248 | 263 | for i = 1:2 |
249 | 264 | whichRamp = i; % 1 for on currents, 2 for off currents |
250 | 265 | normFlag = 0; %normalize to 40mm/s ramp (highest velocity "step") |
251 | | -peakCol = 9; % 6 for peak current, 11 for integrated current/charge |
| 266 | +peakCol = 6; % 6 for peak current, 11 for integrated current/charge |
252 | 267 | % 8 for tauAct, 9 for tauDecay |
253 | 268 | switch peakCol |
254 | 269 | case 6 |
|
371 | 386 | end |
372 | 387 |
|
373 | 388 | out = out(~cellfun(@isempty,out(:,1)),:); |
| 389 | +out(1,:) = cellfun(@(x) regexprep(x,'stim1','ratio'),out(1,:),'un',0); |
| 390 | + |
374 | 391 | xlswrite(fname,out,sprintf('velPeak_ratio')); |
375 | 392 |
|
376 | 393 |
|
|
0 commit comments