Removing sub matrix from 3d matrix, if any values in the matrix exceed a certain min/max value

1 回表示 (過去 30 日間)
I am currently trying to do artifact rejection on my EEG.data. I have three sets of epoched data (in 3D matrices, for example 64(channels)x250(samplingtimes)x98(trials)).
I need to create a loop that runs through my EEG.data files and removes the trials containing values over/under 100 uV. For example, eye blink artifacts are easily detected in the Fp1 and Fp2 channels, which correspond to row 1 and 2 of the first dimension of my matrix. So if EEG.data(1:2, : , trial) >= 100, delete the trial. I am very new to matlab and would really appreciate any help.
for a=size(epochs_CG,3) % for the size of my
if epochs_CG(1:2, :, a)> 100
epochs_CG(:,:,a) = [];
elseif epochs_CG (1:2, :, a)< 100
epochs_CG(:,:,a) = [];
end
end
This did not work :P

採用された回答

Matt J
Matt J 2019 年 3 月 18 日
編集済み: Matt J 2019 年 3 月 18 日
discard=any( any( epochs_CG(1:2, :, :)>=100 ,2) ,1);
epochs_CG(:,:,discard)=[];

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEEG/MEG/ECoG についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by