Dear Joe,
What you should do in this case is:
ev = D.events;
and then ev will be a structure array that you can manipulate the
usual way and then if you want to update the object again you can do:
D = events(D, 1, ev);
The kind of syntax you tried to use works on things like channel
labels or time, but events are different in the way they are handled.
Best,
Vladimir
On Mon, Mar 29, 2010 at 8:05 PM, Joseph Brooks <[log in to unmask]> wrote:
> I'm having trouble accessing all of the event labels that are stored in the
> D object from my EEG data that have been loaded into an SPM file.
>
> D.events shows that there are 1x1521 struct array with fields: type, value,
> duration, time, offset.
>
> However, when I attempt to access one element of this structure using:
> "D.events(3)", for instance, I get the following error:
>
>>> D.events(3)
> ??? Index exceeds matrix dimensions.
>
> Error in ==> getfield at 46
> f = f(index{:});
>
> Error in ==> getset at 25
> res{i} = getfield(this, parent, {ind(i)}, fieldname);
>
> Error in ==> meeg.events at 11
> res = getset(this, 'trials', 'events', varargin{:});
>
> Error in ==> meeg.subsref at 28
> varargout = {feval(subs(1).subs, this, subs(2).subs{:})};
>
>
>
> If I type "D.events(1)" this gives the info below. I would have expected
> specific information about event1???:
>
>>> D.events
>
> ans =
>
> 1x1521 struct array with fields:
> type
> value
> duration
> time
> offset
>
>
>
> I've loaded all of the data as continuous because I wanted to be sure to
> preserve the trial order as I need to make changes to the event labels based
> on their order. If I use "g = D.events" to load the events structure into
> another variable then I can access them all normally (unlike above).
> However, I then can't seem to be able to write the new set of events to the
> D object. I tried "D.events = g;" but this gives the following error:
>
>>> D.events = g;
> ??? Error using ==> meeg.subsasgn at 19
> meeg method names cannot be used for custom fields
>
>
>
> Any help will be much appreciated.
>
> Joe
>
> Just FYI, using Matlab R2009b, SPM recently updated using the SVNupdate
> ulility from the ICN.
>
|