AllCellsBurstPSTH.m 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. function Group = AllCellsBurstPSTH(Group,preStim,postStim, binsize, mkplt)
  2. % ex. Controls = AllCellsBurstPSTH(Controls)
  3. % Compute burst psth and add a field of the input structure
  4. % INPUT:
  5. % Group - (required) Experimental group structure containing
  6. % all cell information
  7. % mkplt - 1 to plot 0 to not plot
  8. % OUTPUT:
  9. % Group - original input structure plus a new field bpsth
  10. for i = 1:length(Group)
  11. BurstTimes = Group(i).BurstTimes;
  12. cellname = Group(i).CellName;
  13. if length(Group(i).Mixes) ~=0
  14. Mixes = Group(i).Mixes;
  15. Mixes(:,3) = 10;
  16. Microstims = [Group(i).Microstims; Mixes];
  17. else
  18. Microstims = [Group(i).Microstims];
  19. end
  20. %HighIntensity = find(Microstims(:,3) >= 40);
  21. %LowIntensity = find(Microstims(:,3) < 40);
  22. HitTimes = find(Microstims(:,2) <= 1.2 & Microstims (:,2) > 0.1);
  23. Hits = Microstims(HitTimes,1);
  24. %HighStimTimes = Microstims(intersect(HighIntensity, HitTimes),1);
  25. %LowStimTimes = Microstims(intersect(LowIntensity, HitTimes),1);
  26. %[bpsthNormHigh,numTrialsHigh edges] = RasterPSTH (HighStimTimes, BurstTimes(1:2:end), preStim, postStim, binsize,'mkplt', false );
  27. %saveas(gcf, [cd, '\RasterPSTH\', cellname, 'RasterPSTHhigh.fig'])
  28. %[bpsthNormLow,numTrialsLow edges] = RasterPSTH (LowStimTimes, BurstTimes(1:2:end), preStim, postStim, binsize,'mkplt', false );
  29. %saveas(gcf, [cd, '\RasterPSTH\', cellname, 'RasterPSTHlow.fig'])
  30. % Total microstim
  31. [bpsthNorm,numHits, edges] = RasterPSTH (Hits, BurstTimes(1:2:end), preStim, postStim, binsize,'mkplt', mkplt);
  32. %Group(i).bpsthNormHigh= bpsthNormHigh;
  33. %Group(i).numTrialsHigh = numTrialsHigh;
  34. %Group(i).bpsthNormLow = bpsthNormLow;
  35. %Group(i).numTrialsLow = numTrialsLow;
  36. Group(i).bpsthNorm= bpsthNorm;
  37. Group(i).numHits= numHits;
  38. %close all
  39. end