Skip to main content
Social Sci LibreTexts

8.18: Matlab Script For This Chapter

  • Page ID
    137761
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    I’ve created a script named MMN_artifact_rejection_example.m that shows how to implement the interpolation and artifact detection processes described in this chapter. You can find it in the Chapter_8 folder. It runs on the data from Subjects 1-10 in the ERP CORE MMN experiment. The datasets for these participants are in a subfolder named MMN_Data.

    The script demonstrates how you can put subject-specific information in an Excel spreadsheet, such as which channels to interpolate and what artifact detection parameters to use, and then have the script read this information and use it to control the interpolation and artifact detection processes. This is a super useful trick!

    I didn’t spend much time customizing the parameters. You can probably do a better job given what you’ve learned in this chapter.

    Most of these participants have a lot of blinks and would need to be excluded from the final analyses because they exceed our criterion of 25% rejected trials. As I noted before, this is because we planned to use artifact correction rather than rejection for blinks, and we did nothing to minimize blinking. I should also note that Subject 7 has a ton of low-frequency drift (probably coming from the reference electrodes, because it’s present in all the EEG channels) and was excluded from the final analyses in the ERP CORE paper.


    This page titled 8.18: Matlab Script For This Chapter is shared under a CC BY 4.0 license and was authored, remixed, and/or curated by Steven J Luck directly on the LibreTexts platform.