gb_background_activity.m 761 B

12345678910111213141516171819202122232425262728293031
  1. function [amplitudes, sweep_cut] = gb_background_activity(cfg, data)
  2. sweep_start = round(cfg.start_time*cfg.SR);
  3. sweep_end = round(cfg.end_time*cfg.SR);
  4. for x = 1:length(cfg.sp_trigger)
  5. sweep_points{x} = sweep_start+cfg.sp_trigger(x):cfg.sp_trigger(x)+sweep_end;
  6. sweep_cut{x} = data(sweep_points{x});
  7. %plot(sweep_cut{x})
  8. switch cfg.analysis
  9. case 'p2p'
  10. MEP_max{x} = max(sweep_cut{x});
  11. MEP_min{x} = min(sweep_cut{x});
  12. amplitudes(x,1) = MEP_max{x} - MEP_min{x};
  13. case 'mean'
  14. amplitudes(x,1) = mean(sweep_cut{x});
  15. case 'median'
  16. amplitudes(x,1) = median(sweep_cut{x});
  17. case 'sum'
  18. amplitudes(x,1) = sum(sweep_cut{x});
  19. end
  20. end