Hello, I am having a lot of trouble writing a script.
I have read the extensive documentation from the tutorial section, and have read into the internal variables and parameters in the functions/commands themselves. I am really at a loss here, and would greatly appreciate help.
I have a [time x channel] (32 channels) EEG .mat matrix and a custom channel file. I have this channel file as both a .mat struct, and an ASCII XYZ, Name format.
My goal is, without the GUI, to create a subject, import and assign the EEG matrix to the subject, and import and assign the channel file to the subject.
I successfully can create the subject, and can successfully import the EEG matrix. However, I am having trouble with the channel file. Once the EEG is imported, it appears the brainstorm GUI creates a default channel file "Brainstorm channels (32)". This channel appears to have the default channel names and channel locations.
When I try to import my own channel files, it does not change anything, nor does it import it.
This is what brainstorm displays:
To summarize, may someone tell me if there is a function/command to import a custom channel file, in either .txt "ASCII XYZ. Name" format OR a channel struct file (the layout of the struct is the correct format, I checked).
Thank you so much, and here is the code:
% Paths and filenames
addpath("D:\EEG_Epilepsy\Codes\Will Stuff\Functions");
addpath("D:\EEG_Epilepsy\Codes\Will Stuff\EEG Data");
eegPath = "D:\EEG_Epilepsy\Codes\Will Stuff\EEG Data";
subjectEEGpath = 'Data_EEGonly016.mat';
eegFullPath = fullfile(eegPath, subjectEEGpath);
channelpath = 'D:\EEG_Epilepsy\Codes\Will Stuff\EEG Data\Data_EEG_Channels.txt';
% subject info - using subject 16 as a place holder
% subjectEEGpath = 'Data_EEGonly016.mat';
subjectID = 'Subject016';
% create protocol - just run once then comment out
brainstorm nogui
% gui_brainstorm('CreateProtocol', 'DeltaTestingV2', 0, 0);
% Check if subject already exists
if isempty(bst_get('Subject', ID))
db_add_subject(ID, [], 0, 0);
else
fprintf('Skipped (already exists): %s\n', ID);
end
% Import EEG .mat file (make sure it's a matrix variable like "eeg" in .mat)
bst_process('CallProcess', 'process_import_data_raw', [], [], ...
'subjectname', subjectID, ...
'condition', '', ...
'datafile', {eegFullPath, 'EEG-MAT'}, ...
'DataMatTranspose', 1);
% import channel file
bst_process('CallProcess', 'process_import_channel', [], [], ...
'subjectname', 'Subject016', ...
'channelfile', {'D:\EEG_Epilepsy\Codes\Will Stuff\EEG Data\Data_EEG_Channels.txt', 'ASCII: XYZ'}, ...
'usedefault', 0, ...
'channelalign', 1);
