Creating function for baseline correction

14 ビュー (過去 30 日間)
User48765
User48765 2019 年 3 月 20 日
コメント済み: Star Strider 2019 年 3 月 20 日
Hi!
I am trying to do a baseline correction of my epoched EEG data (64(channels)x250(sampling rate) x 586(trials) matrix). The baseline correction should compute the mean across the columns (so the mean for every row) between some startT and endT (should be specified in ms) before stimulus presentation (which is always at 0, or from columns nr 51 in the matrix). I have another vector containing the sampling times (times= [-200:4:796]). I need to somehow create a function that takes startT and endT as inputs, and computes the the mean value for each of the rows from startT(ms) to endT(ms), and then subtracts this value from each corresponding element in the matrix.
for i = 1:size(epochs_CG)
baselineCG = mean(epochs_CG(:,1:50,:), 2)
end
epochs_CG = epochsCG - baselineCG;
So this works when I run it, but I can't figure out how to write it as a function. I'm sorry, I'm new to matlab, would appreciate any help!

採用された回答

Star Strider
Star Strider 2019 年 3 月 20 日
If you want to understand how to write MATLAB functions, see: Function Basics (link).
  4 件のコメント
User48765
User48765 2019 年 3 月 20 日
Thank you so much!
Star Strider
Star Strider 2019 年 3 月 20 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (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