Hi Marcel,
First I think the variable containing the modulatory information must be
named "mod" rather than "pmod". Second the variable types of each field
have to be correctly specified, i.e. mod.name has to be a
character-array and mod.param and mod.poly have to be of type double
(and not cell-arrays as specified in your example). In your case
something like this might work:
mod(1).name = 'modulation_EventClass1';
mod(1).param = cell2mat(xlsread(filename, 'Sheetname', 'B3:B147'));
mod(1).poly = 1;
save('SPM_example','names','onsets','durations','mod');
Good luck,
Thilo
PS: Viele Grüße aus Aachen. Bei der Entfernung könnte man sich mal
wieder auf ein Bier treffen, oder?
On Wed, 2009-11-11 at 14:23 +0000, Marcel Daamen wrote:
> Dear SPMers,
>
> I have problems to include paramatric modulations into my multiple condition
> mat-files (SPM5).
>
> I adapted an existing matlab routine to transfer event parameters from Excel
> files, and this worked fine for simple event-related designs (with cell
> arrays for names, onsets, durations only). Now I tried to add the struct
> array for parametric modulations (as suggested in the SPM5 help), and save
> it to the multiple conditions mat-file.
>
>
> pmod = struct('name',{''},'param',{},'poly',{});
>
> pmod(1).name{1} = cellstr('modulation_EventClass1');
>
> pmod(1).param{1} = xlsread(filename, 'Sheetname', 'B3:B147');
>
> pmod(1).poly{1} = 1;
>
> .....
>
> try
> uisave({'names','onsets','durations','pmod'}, 'SPM_example' );
> .....
> catch
> errordlg('Problems occured. Please, check write permission etc...');
> end
>
>
> The content (see the attached example file) looks sensible to me. Moreover,
> if I load the mat-file into workspace before creating my GUI batch, I can
> insert the parametric modulation values for single conditions manually, e.g.
> by calling up pmod(1).param{1}. But if I use this mat-file in the multiple
> conditions menu and run the batch, SPM stops and asks me if I want to
> include parametric modulators, and to insert them manually.
>
> Obviously, the array structure of my pmod struct array is not compatible
> with what SPM is waiting for. Unfortunately, I couldn't find examples for
> multiple conditions files which include parametric modulations, so I
> couldn't figure out where my script/ file structure is wrong. Therefore, I
> would be very grateful if someone could send me an example for a correct
> multiple conditions file which includes parametric modulations.
>
> Or can someone already recognize at first glance where my script is faulty?
> I am sure that the reason is trivial, but since my Matlab experiences are
> quite poor, I would be grateful for helpful suggestions....
>
>
> Thanks in advance!
>
> Best regards,
>
> Marcel
>
>
>
> Dipl.-Psych. Marcel Daamen
> Department of Radiology
> Functional Neuroimaging Group
> Friedrich-Wilhelm-University Bonn
> Sigmund-Freud-Str. 25
> D 53105 Bonn
> Marcel.Daamen(at)ukb.uni-bonn.de
|