Custom processing for ABR weighted averaging

Thank you Francois :slight_smile:

I am now using the "Pre-process > Run Matlab command and managed to work out that the following code does what I need it to do for weighted epoching.

EpochW = ones(2,1)./var((Data),0,2);
Data = EpochW.*(Data);

Because the process category of Run Matlab command is "Filter", the process considers each file one at a time independently and saves each file. As I have 6000 epochs, after running through this process, I now have a new set of 6000 processed epochs which is what I was expecting.

Now an issue arose when doing averaged weighted epoching.
I need to take the sum of all the newly generated 6000 processed epochs giving me a single row vector containing the sum of each column (time). I then need to divide this by the sum of the outcome of the code "EpochW = ones(2,1)./var((Data),0,2)".

What would be the possible code for this?
Can Run Matlab command handle something like this when its process category is "Filter"?
I understand that process category "Custom" would work better in this situation as all the input files are passed at once to the process.

Thoughts?