function Group = AllCellsBurstPSTH(Group,preStim,postStim, binsize, mkplt) % ex. Controls = AllCellsBurstPSTH(Controls) % Compute burst psth and add a field of the input structure % INPUT: % Group - (required) Experimental group structure containing % all cell information % mkplt - 1 to plot 0 to not plot % OUTPUT: % Group - original input structure plus a new field bpsth for i = 1:length(Group) BurstTimes = Group(i).BurstTimes; cellname = Group(i).CellName; if length(Group(i).Mixes) ~=0 Mixes = Group(i).Mixes; Mixes(:,3) = 10; Microstims = [Group(i).Microstims; Mixes]; else Microstims = [Group(i).Microstims]; end %HighIntensity = find(Microstims(:,3) >= 40); %LowIntensity = find(Microstims(:,3) < 40); HitTimes = find(Microstims(:,2) <= 1.2 & Microstims (:,2) > 0.1); Hits = Microstims(HitTimes,1); %HighStimTimes = Microstims(intersect(HighIntensity, HitTimes),1); %LowStimTimes = Microstims(intersect(LowIntensity, HitTimes),1); %[bpsthNormHigh,numTrialsHigh edges] = RasterPSTH (HighStimTimes, BurstTimes(1:2:end), preStim, postStim, binsize,'mkplt', false ); %saveas(gcf, [cd, '\RasterPSTH\', cellname, 'RasterPSTHhigh.fig']) %[bpsthNormLow,numTrialsLow edges] = RasterPSTH (LowStimTimes, BurstTimes(1:2:end), preStim, postStim, binsize,'mkplt', false ); %saveas(gcf, [cd, '\RasterPSTH\', cellname, 'RasterPSTHlow.fig']) % Total microstim [bpsthNorm,numHits, edges] = RasterPSTH (Hits, BurstTimes(1:2:end), preStim, postStim, binsize,'mkplt', mkplt); %Group(i).bpsthNormHigh= bpsthNormHigh; %Group(i).numTrialsHigh = numTrialsHigh; %Group(i).bpsthNormLow = bpsthNormLow; %Group(i).numTrialsLow = numTrialsLow; Group(i).bpsthNorm= bpsthNorm; Group(i).numHits= numHits; %close all end