Hi Vladimir, Thank you for your answer. I made sure SPM is on top of my path. I launched SPM as well to make sure the subfolders and private folders were on the path. I can epoch if I use the batch. However I want to write to my own code to do it. I have copied most of the SPM code and it seems that the built-in functions overload most of the MEEG methods. I am only able to use the methods with the form D.method, but cannot do method(D). Methods like fname(D) return this error: Error using subsindex Function 'subsindex' is not defined for values of class 'meeg' which subsindex built-in (C:\Program Files\MATLAB\R2014b\toolbox\matlab\ops\subsindex) I just updated SPM12. I have Matlab 2014b under Windows 7 enterprise 64b. Why would this work fine when launching from the batch but not when doing it myself? D.events(1,evtspm) works fine, D.fname as well. Thank you! Best, Jessica On 8/21/2015 2:41 AM, Vladimir Litvak wrote: > Dear Jessica, > > I've never encountered this problem, but: > > 1) You can make sure that SPM is on top of your MATLAB path. > 2) The syntax D = D.events(1,evtspm); should work in any case. > > Best, > > Vladimir > > On Thu, Aug 20, 2015 at 11:10 PM, Jessica Schrouff > <[log in to unmask] <mailto:[log in to unmask]>> wrote: > > Dear SPM developers and users, > > I am re-writing a function to epoch EEG data, as we want to epoch > around the offset/RT (variable), but baseline correct around the > onset of each event (fixed). > > To this end, I want to get the events I have from another file > into my D object, using: D = events(D,1,evtspm); with evtspm the > structure with all my events as in the SPM format. > > However, I get the following message: > Error using subsindex > Function 'subsindex' is not defined for values of class 'meeg'. > > This is because the 'events' function called is the Matlab built-in: > which events > built-in (C:\Program > Files\MATLAB\R2014b\toolbox\matlab\datatypes\events) > > Everything is on my path and SPM12 was running when I attempted > this. It also shows that the Matlab events function overloads the > meeg/events. > > What can I do to be able to call the meeg/events? > Thank you for your help. > > Best, > Jessica > >