Dear Vladimir,
I was wondering if you could help me with something – Rik advised that I contact you as he’s unfamiliar with Fieldtrip.
I’m trying to run a fieldtrip non-parametric analysis on Time Frequency data, to look at effects between two conditions over time, frequency and channel. I have attached the current script to aid with explanation of the issue.
The initial analysis was performed using SPM12 and a new file was created per condition (e.g. ‘1mretf_Mspm12…’) for condition 1 (prefix altered based on condition) [ lines 77:94 in attached script, also below]
(for c = 1:2; %length(condprefix)
for p = 1:length(cbu_codes{g});
sub_wd = fullfile(bas_wd,expts{e},groups{g},cbu_codes{g}{p});
for r = 1;
ofnam = sprintf('%s%s_%s',expts{e}, runs{r}, basefile);
infile = fullfile(sub_wd,sprintf('%sspm12_%s.mat',ana,ofnam));
D = spm_eeg_load(infile);
% create different files per condition
S = [];
S.D = D;
S.c = cons{g}{e}.wgts(c,:);
S.label = condprefix{c};
S.prefix = condprefix{c};
D = spm_eeg_contrast(S);
end
end
end)
The spm2fieldtrip function was then performed [lines 101:113] however this fails due to insufficient input
(for c = 1:length(condprefix); %condition 1
for p = 1:length(cbu_codes{g});
% for m = 1:length(modalities);
sub_wd = fullfile(bas_wd, expts{e}, groups{g}, cbu_codes{g}{p});
filename = fullfile(sub_wd,sprintf('%s%sspm12_%s%s_%s.mat', condprefix{c} ,ana, expts{e}, runs{r}, basefile));
filename_load = spm_eeg_load(filename);
D = spm2fieldtrip(filename_load);
% D = spm2fieldtrip(filename_load, modalities{m});
Cond{c}{p} = D;
% end
end
end)
“Error using meeg/ftraw (line 15)
Not enough input arguments.
Error in meeg/subsref (line 112)
varargout = {feval(subs(1).subs, this, subs(2).subs{:})};
Error in spm2fieldtrip (line 30)
data = D.ftraw(0);”
However, when I attempt to add other input arguments (such as modality) e.g.
(for c = 1:length(condprefix); %condition 1
for p = 1:length(cbu_codes{g});
for m = 1:length(modalities);
sub_wd = fullfile(bas_wd, expts{e}, groups{g}, cbu_codes{g}{p});
filename = fullfile(sub_wd,sprintf('%s%sspm12_%s%s_%s.mat', condprefix{c} ,ana, expts{e}, runs{r}, basefile));
filename_load = spm_eeg_load(filename);
% D = spm2fieldtrip(filename_load);
D = spm2fieldtrip(filename_load, modalities{m});
Cond{c}{p} = D;
end
end
end)
I get the error:
“Error using spm2fieldtrip
Too many input arguments.”
I have performed this spm2fieldtrip function before on data averaged over frequency and it successfully worked; I’m not sure why it fails this time.
Your help with this would be greatly appreciated!
Best wishes
Rebecca Beresford.
Rebecca Beresford
PhD Student
MRC Cognition & Brain Sciences Unit
15 Chaucer Road
Cambridge, CB2 7EF
EnglandEMAIL: [log in to unmask]
TEL +44 (0)1223 273 664
http://www.mrc-cbu.cam.ac.uk/people/rebecca.beresford/