[Eeglablist] Characters vs Strings in MATLAB and EEGLAB

Seyed Yahya Shirazi shirazi at ieee.org
Mon Jun 12 12:46:26 PDT 2023


Dear James,

This is a very good question. EEGLAB is designed for character arrays (single quotes) not string arrays. As you know, unlike Python, character arrays and string arrays are handled differently in Matlab. So, passing strings to EEGLAB functions will cause problems here and there.

As an example, if you have EEG.setname as a string (not a char array), try to save the EEG set using pop_saveset() and load it again using pop_loadset(), you will see that the EEG.setname is empty!

My suggestion is to always pass the char() version of the strings to the EEGLAB functions to avoid unexpected outcomes.

Best,
Yahya
______________________

Seyed (Yahya) Shirazi, Ph.D., Postdocoral Scholar, Swartz Center for Computational Neuroscience, UCSD, neuromechanist.github.io <https://urldefense.com/v3/__https://neuromechanist.github.io/__;!!Mih3wA!CLp-ttzUGEkzMLQ0vtWXgmYDpYm5fBh5V5fP5ucuM9iLhkwFKMS_5fKJOoNDczItVmLb8RHst8A_n1EAmGqC$ >



More information about the eeglablist mailing list