https://github.com/OHBA-analysis/HMM-MAR
Raw File
Tip revision: df84f129c4d6a2f36757f137da28466b7ae5c3d5 authored by robecker on 05 December 2016, 18:12:29 UTC
Merge branch 'master' of https://github.com/OHBA-analysis/HMM-MAR into robert_stochastic
Tip revision: df84f12
flipdata.m
function X = flipdata(X,T,flips)
% Flip the channels of X according to flips (no. trials x no.channels),
% which is the output of findflip.
%
% Author: Diego Vidaurre, University of Oxford.

N = length(T); ndim = size(X,2);
for in = 1:N
    ind = (1:T(in)) + sum(T(1:in-1));
    for d = 1:ndim
        if flips(in,d)
            X(ind,d) = -X(ind,d);
        end
    end
end
end
back to top