Dear Vladimir
Thanks for this info. Not sure if the problem is specific to my peculiar
processing sequence or a more general issue for converting EEGLab data in
SPM8. In anycase attached a brief sript following your advice below to solve
this in case it is useful...although others might find a better alternative
is to create a trl file using the advice in another recent email from you
(search the subject heading 'epoch' in the archives).
%%
evt_in = events(D);
evt_in1 = [evt_in.value];
cond_values1 = unique(evt_in1);
for evt_cnt = 1 : size(evt_in,2)
if strcmp(evt_in(evt_cnt).value, 'boundary') == 1
evt_in(evt_cnt).value = 255;
else
evt_in(evt_cnt).value = str2double({evt_in(evt_cnt).value});
end
end
D = events(D, 1, evt_in);
save(D);
%%
Cheers
Bill
> -----Original Message-----
> From: SPM (Statistical Parametric Mapping)
> [mailto:[log in to unmask]] On Behalf Of Vladimir Litvak
> Sent: Saturday, 19 June 2010 1:14 AM
> To: [log in to unmask]
> Subject: Re: [SPM] Problem converting EEGlab data to SPM8
>
> Dear Bill,
>
> I think the problem is that you have values that are numeric
> strings, like '1', '2'. This is indeed not something possible
> to handle via the GUI because SPM assumes that a numeric
> string specified in the GUI should be converted to a number.
> If you do the epoching via a script it should be possible to
> specify a numeric string as value.
> Alternatively, you can indeed convert them back to numbers
> just perhaps do it in a loop and if you get a NaN, don't
> change the value.
>
> Best,
>
> Vladimir
>
> On Fri, Jun 18, 2010 at 12:27 PM, Bill Budd
> <[log in to unmask]> wrote:
> > Dear Valdimir.
> >
> > The error I get after running spm_eeg_epochs is:
> >
> > ??? Index exceeds matrix dimensions.
> >
> > Error in ==> spm_eeg_definetrial at 202 [junk, sortind] =
> > sort(trl(:,1));
> >
> > Error in ==> spm_eeg_epochs at 101
> > [epochinfo.trl, epochinfo.conditionlabels, S] =
> > spm_eeg_definetrial(S_definetrial);
> >
> >>>
> >
> > Have attached the event structure where the event.value
> field is in a
> > different format than usual (assumed it was because of the strings).
> > This is a matlab mat file.
> >
> > Many Thanks for looking at this.
> >
> > Cheers
> >
> > -Bill
> >
> >
> >> -----Original Message-----
> >> From: SPM (Statistical Parametric Mapping)
> >> [mailto:[log in to unmask]] On Behalf Of Vladimir Litvak
> >> Sent: Friday, 18 June 2010 7:01 PM
> >> To: [log in to unmask]
> >> Subject: Re: [SPM] Problem converting EEGlab data to SPM8
> >>
> >> Dear Bill,
> >>
> >> There should be no problem whatsoever for event.value to
> be a string.
> >> So if epoching fails it must be for a different reason.
> What is the
> >> error you got? Perhaps you should send me an example. I'm not sure
> >> about NaN as value. That might be a problem because NaN doesn't
> >> behave like a normal number in many situations.
> >>
> >> If you modified events and want to put them back you can use:
> >>
> >> D = events(D, 1, event_struct);
> >> save(D);
> >>
> >> Vladimir
> >>
> >> Sent from my iPad
> >>
> >> On 18 Jun 2010, at 08:42, Bill Budd
> >> <[log in to unmask]> wrote:
> >>
> >> > Dear Vladimir
> >> >
> >> > I'm preprocessing some Biosemi data in EEGlab and then
> >> convert to SPM8
> >> > for analyses. Problem has been that the format of the
> event struct
> >> > (from
> >> > event(D)) has changed since some of the event.value
> fields contain
> >> > strings (i.e. 'boundary')and so spm_eeg_definetrial
> fails to create
> >> > trl. I can convert event.struct back to double OK using:
> >> >
> >> > event_struct = events(D);
> >> > event_values = {event_struct.value}; event_values =
> >> > str2double(event_values); event.value = event_values;
> >> >
> >> > This changes the original strings to 'NaN' (which isnt a
> >> problem for
> >> > me but not sure about SPM8?), also not sure how to
> incoporate this
> >> > changed format event structure into the data using the methods
> >> > event(D)and save(D). Any advice greatfully appreciated.
> >> >
> >> >
> >> > Cheers
> >> > -Bill
> >
|