correct_baseline.m 449 B

1234567891011
  1. function [data, baseline_value] = correct_baseline(data,goodtrials,t,baselinewin)
  2. % simple baseline correction function. inputs:
  3. % - data (time x trials)
  4. % - array of booleans describing which trials are good
  5. % - timescale
  6. % - [start end] baseline window in same unit as timescale
  7. bl = find(t>baselinewin(1) & t<baselinewin(2));
  8. baseline_value = mean(mean(data(bl,goodtrials==1)));
  9. data = data - baseline_value;
  10. end