Hi all,
I have a large matrix of EMG data, with 2000 trials(2000×501) for 10 subjects. I need to calculate the mean and std for certain epochs of this data. Here an example of what I need to do:
%%calculate mean activity for pre, R1, R2, R3 and vol
j=find(data.DotsDirection==-1 & data.CorrectTarget(:)==1); % 1st muscle
m1pre=mean(mean((data.emg1(j,1:129)),2)); % mean emg for pre epoch for all trials
m1r1=mean(mean((data.emg1(j,129:151)),2)); m1r2=mean(mean((data.emg1(j,151:184)),2));
So with the first step I select only certain trials, with the second step I calculate the mean per epoch. As you see I first calculated the mean per epoch per trial and then took the mean of this again (as I need one value for the mean and std). I need to do the same for the std but I'm wondering if I'm actually allowed to do this? Or is there a function that allows me to take the mean/std per epoch in one step?
Any help appreciated!
Best Answer