% data is in object gsr and already preprocessed % onsets are in variable onsets, data in channel 1 curves = cell(numel(onsets), 2); for cc = 1:numel(onsets) curves{cc, 1} = sprintf('Onset %d, t=%.4f', cc, onsets(cc)); curves{cc, 2} = [1, onsets(cc) - 2, onsets(cc) + 20]; end % we define three spots of interest: % - onset (time of stimulus), % - delay of response (minimum before peak), % - and peak of response (amplitude) spotnames = {'onset', 'delay', 'peak'}; spottype = {'onset', 'min', 'max'}; % the spots are simply defined as the onsets (and added values) spots = {onsets, onsets + 3, onsets + 7}; % then we define some variables of interest: % - Latency (defined as x-diff between onset and delay) % - Response time (defined as x-diff between delay and peak) % - Base amplitude (defined as y-value at delay) % - Peak amplitude (defined as y-value at peak) % - Peak-to-peak response amplitude (defined as y-diff between delay and peak) % additionally, we define that for the response amplitude, the log+1 transform % should be applied after we're done vars = struct( ... 'name', {'Latency', 'Resp. time', 'Base ampl.', 'Peak ampl.', 'Resp. ampl.'}, ... 'calc', {'dx', 'dx', 'y', 'y', 'dy'}, ... 'spot', {[1,2], [2,3], [2], [3], [2,3]}, ... 'trans', {'none', 'none', 'none', 'none', 'log+1'}); % options: % - data is now in channel 10 (filtered!) % - original data is in channel 1 (pre-filter) % - variables and spots as defined pcopts = struct( ... 'var', vars, ... 'spot', {spot}, ... 'spotnames', {spotnames}, ... 'spottype', {spottype}); % now we call plotcurves plotcurves(gsr, pcopts);