MATLAB: Undefined function ‘start’ for input arguments of type ‘double’.

eeglab

Hi all,
I am using the EEGlab software add-on to MATLAB in order to analyze some EEG data that we collected in lab.
I have about 800 seconds of continuous EEG data that is composed of 24 individual trials. I have a script that allows me to use the time intervals of each trial and isolate the data for each trial and average everything on a per-condition basis (i.e. with 24 different conditions).
I am having trouble when running this script, and am getting the error message that is listed in the title of this post.
I'm not sure why "start" is being recognized as a function, since when I type in "start" to the command window it tells me that start is an undefined function. Also, I understand that this error might be due to the function not being specified in the path, but when I enter "which start" into the command prompt, MATLAB tells me the following:
C:\Program Files\MATLAB\R2013a\toolbox\matlab\iofun\@timer\start.m
It would appear that start.m is a function under some timer toolbox. How can I get matlab to stop directing to this start function? I want "start" to represent the physical start time of the EEG trial, and "finish" to represent the finish time of the EEG trial.
Here is the script in case you wanted to analyze. Any help is appreciated!
fs = EEG.srate;
% the numbers 1-24 need to be replaced with the appropriate time points for % each trial's start (1s after actual start) and end. r1 = EEG.data(:,start(1)*fs:finish(32)*fs) r2 = EEG.data(:,start(37.48)*fs:finish(68.48)*fs); r3 = EEG.data(:,start(73.63)*fs:finish(104.63)*fs); r4 = EEG.data(:,start(109.79)*fs:finish(140.79)*fs); r5 = EEG.data(:,start(145.94)*fs:finish(176.94)*fs); r6 = EEG.data(:,start(182.10)*fs:finish(213.10)*fs); r7 = EEG.data(:,start(218.26)*fs:finish(249.26)*fs); r8 = EEG.data(:,start(254.41)*fs:finish(285.41)*fs); r9 = EEG.data(:,start(290.58)*fs:finish(321.58)*fs); r10 = EEG.data(:,start(326.73)*fs:finish(357.73)*fs); r11 = EEG.data(:,start(362.89)*fs:finish(393.89)*fs); r12 = EEG.data(:,start(399.05)*fs:finish(430.05)*fs); r13 = EEG.data(:,start(435.21)*fs:finish(466.21)*fs); r14 = EEG.data(:,start(471.37)*fs:finish(502.37)*fs); r15 = EEG.data(:,start(507.52)*fs:finish(538.52)*fs); r16 = EEG.data(:,start(543.68)*fs:finish(574.68)*fs); r17 = EEG.data(:,start(579.84)*fs:finish(610.84)*fs); r18 = EEG.data(:,start(615.99)*fs:finish(646.99)*fs); r19 = EEG.data(:,start(652.14)*fs:finish(683.14)*fs); r20 = EEG.data(:,start(688.29)*fs:finish(719.29)*fs); r21 = EEG.data(:,start(724.45)*fs:finish(755.45)*fs); r22 = EEG.data(:,start(760.59)*fs:finish(791.59)*fs); r23 = EEG.data(:,start(796.76)*fs:finish(827.76)*fs); r24 = EEG.data(:,start(832.92)*fs:finish(863.92)*fs);
avg_afr = (r1+r2+r3+r4+r5+r6+r7+r8+r9+r10+r11+r12)/12;
avg_west = (r13+r14+r15+r16+r17+r18+r19+r20+r21+r22+r23+r24)/12;

Best Answer

"which start" ... tells me the following:
C:\Program Files\MATLAB\R2013a\toolbox\matlab\iofun\@timer\start.m
_It would appear that start.m is a function under some timer toolbox. How can I get matlab to stop directing to this start function? I want "start" to represent the physical start time of the EEG trial, and "finish" to represent the finish time of the EEG trial.
You really, really, don't want to do that -- aliasing Matlab functions leads to "there be dragons" problems. Use a different spelling or somesuch -- say "Start" and "Finish" or somesuch.
EEG.data(:,start(37.48)*fs:finish(68.48)*fs);
You've got a problem here anyway--you've written a floating point value as a subscript into what I guess you want to be an array. "You can't do that!" Even if there weren't an function start you would get an error/warning for the bad subscript -- "Subscript indices must either be real positive integers or logicals."
You can store the starting/ending times in an array at some index value; you can't use the time itself as that index.