I am working on Chapter 9 of your book “Analyzing Neural Time Series Data”. There is a section of code generating Figure 9.4. It calls the EEGLAB Function totoplot.
— Your code generated the following error message ----
Unrecognized function or variable ‘icadefs’.
Error in topoplot (line 219)
icadefs % read defaults MAXTOPOPLOTCHANS and DEFAULT_ELOC and BACKCOLOR
Error in chapter09_Lesson (line 162)
[~,~,~,~,~,xi,yi,pltchans] = topoplot(zeros(64,1),EEG.chanlocs,‘electrodes’,‘off’,‘plotrad’,.53);
----- End of error message —
Matlab version: R2020b
EEGLab version: 2020_0
I have followed the instruction in your code: you need to modify the eeglab function ‘topoplot’. Replace the first line of code (the function definition) with: function [handle,Zi,grid,Xi,Yi,x,y,pltchans] = topoplot(Values,loc_file,varargin)
Image (png) of Matlab workspace showing the topoplot.m and variables, is attached.
Hi Larry. That looks like an eeglab initialization issue. I think you will need to initialize eeglab for the topoplot function (or any other eeglab functions) to work properly. That’s a feature of newer versions of eeglab compared to when I wrote the book.
Thus, I believe that if you type eeglab; close
and then try the topoplot function again, it should work. Hopefully
Thanks for the reply. Your advice prompt me to include EEG function directory in the Matlab default path setup. After I did that, your code for figure 9.4 worked. However, the contour lines are not plotted in the figure on the right. Please help understand how to fix it.