26 lines
541 B
Mathematica
26 lines
541 B
Mathematica
|
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
|
||
|
|
||
|
|