method to return event specifications for all event in model FORMAT [e_specs e_names] = event_specs(D) D - design object Returns e_specs - event specification 2 by N matrix where row 1 is the session number of the event, row 2 is the event number in the session e_names - names of each event $Id$
0001 function [e_specs, e_names] = event_specs(D) 0002 % method to return event specifications for all event in model 0003 % FORMAT [e_specs e_names] = event_specs(D) 0004 % 0005 % D - design object 0006 % 0007 % Returns 0008 % e_specs - event specification 2 by N matrix where row 1 is the 0009 % session number of the event, row 2 is the event number in 0010 % the session 0011 % 0012 % e_names - names of each event 0013 % 0014 % $Id$ 0015 0016 if ~is_fmri(D) 0017 error('Needs FMRI design'); 0018 end 0019 0020 SPM = des_struct(D); 0021 Sess = SPM.Sess; 0022 nsess = length(Sess); 0023 0024 e_specs = []; 0025 e_names = {}; 0026 e_ctr = 1; 0027 for ss = 1:nsess 0028 nevs = length(Sess{ss}.name); 0029 e_specs = [e_specs [ones(1, nevs) * ss; 1:nevs]]; 0030 e_names = [e_names Sess{ss}.name]; 0031 end 0032 0033