Dear all,
I was also running into the frustrating problem of not being able to
specify event durations of different epoch lengths for the different
conditions within a run (session). Even though I had
bf_ep(1).length = 10
bf_ep(2).length = 20
it would always use bf_ep(1)
I tracked the problem down to spm_input.m where I noticed a couple of
dereferencing problems.
One of them occurs on line 153 in spm_input.m:
lastvar = lastvar(indices{:});
The problem is illustrated by the following output:
K>> lastvar(1)
ans =
ep_type: 4
length: 10
conv: 1
deriv: 0
K>> lastvar(2)
ans =
ep_type: 4
length: 20
conv: 1
deriv: 0
K>> indices{:}
ans =
2
K>> lastvar(indices{:})
ans =
ep_type: 4
length: 10
conv: 1
deriv: 0
Obviously, in trying to dereference lastvar with indices{:}, matlab grabs
lastvar(1) instead of lastvar(2).
A similar dereferencing problem occurs *sometimes* (!!!) at line 133 in
spm_input:
indices{1} = getfield(lastvar,indices,cind{k},cind(k+1));
cind(k+1) is improperly dereferenced.
I wrote a cludgy fix of spm_input.m shown as diff output below:
$ diff spm_input.m spm_input.m.orig
133,138c133
< if isa(cind{k+1},'double')
< evalstr = sprintf('indices{1} = getfield(lastvar,indices,cind{k},{%d});', cind{k+1});
< eval(evalstr)
< else
< indices{1} = getfield(lastvar,indices,cind{k},cind(k+1));
< end
---
> indices{1} = getfield(lastvar,indices,cind{k},cind(k+1));
158,164c153
<
< if isstruct(lastvar)
< evalstr = sprintf('lastvar = lastvar(%d);', indices{:});
< eval(evalstr)
< else
< lastvar = lastvar(indices{:});
< end
---
> lastvar = lastvar(indices{:});
The fix results in a design matrix with the desired variable epoch
durations, and it doesn't seem to have adversely impacted other routines
that utilize spm_input in batch mode. However, I haven't tested the
complete batch interface to make sure that this is 100% true.
Why there is the strange dereferencing behavior is beyond me ...
Cheers,
Petr
On Fri, 22 Sep 2000, Kalina Christoff wrote:
>
> Matthew,
>
> > It appears to me that it isn't possible to specify variable event durations in
> > batch mode, when there is more than one condition per session (which is surely
> > the most common case) (spm_get_ons.m lines 256-274). Is that right? Has anyone
> > invented a way round this if so?
>
> I haven't been able to specify variable event durations either - instead,
> what I've been doing is specify the conditions as regressors, after
> generating one regressor per condition per session, by creating a stick
> function of ones and zeros, convolving it with the output from spm_hrf
> (all this at 10 bins per second) and then sub-sampling from the
> resulting function at the TR.
>
> Would be very interested to hear if anyone has worked out a different
> method though.
>
> Best,
> -k.
>
>
> _____________________________________________________________________________
> Kalina Christoff Email: [log in to unmask]
> Office: Rm.478; (650) 725-0797
> Department of Psychology Home: (650) 497-7170
> Jordan Hall, Main Quad Fax: (650) 725-5699
> Stanford, CA 94305-2130 http://www-psych.stanford.edu/~kalina/
> _____________________________________________________________________________
>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|