ET_PDToolkit/PDToolkit/@PDTrial/stick_model.m

26 lines
541 B
Mathematica
Raw Normal View History

2018-06-12 14:49:55 +02:00
function[model] = stick_model(obj, varargin)
if nargin == 1
amplitudes = ones(1, length(obj.labels));
else
amplitudes = varargin{1};
end
if (length(amplitudes) ~= length(obj.labels))
error('More parameters than events.');
end
start_trial= obj.time(1);
time = obj.deconvolution.time - start_trial;
model = zeros(1, length(time));
for l = 1:length(obj.labels)
onset = obj.labels(l).time - start_trial;
post_onset_ind = find(time > onset);
model(post_onset_ind(1)) = amplitudes(l);
end