% loading the data % (in this case a MAT file written by Acqknowledge for ACQ Version >= 4) % which is in 200Hz sampling frequency with % GSR = channel 1 and % ECG = channel 2 load 6701.acq.mat % the stimulus channel in this example is channel 3, % coded with 0 Volts for no stimulus and 5V for stimulus % thus, to find the time points (samples) on which a % stimulus occurs, we look for spots in this channel % where the value changes from below 2.5V to above 2.5V stimactive = (data(:, 3) > 2.5); onsets = find(~stimactive(2:end) & stimactive(1:end-1)); % creating the necessary information for plotcurves % the onset is shifted by 200 samples (1 second) to show % a window of [-1 .. 14] (in seconds) c = cell(numel(onsets), 2); for cc = 1:numel(onsets) c{cc,1} = sprintf('Onset %d, t=%.3f', cc, onsets(cc)/200); c{cc, 2} = [1, onsets(cc)-200, onsets(cc)+2800]; end % calling plotcurves plotcurves(data, struct('curves', {c}, 'freq', 200));