Good afternoon and Happy Easter,
I am quite new to Brainstorm and MatLab syntax in general. However, I am attempting to systematically take a subjects' data and create new event codes out of combinations of existing ones. Say, for instance, I wanted to examine whether the stimuli was presented on the top of the screen or the bottom, for top it would be events (31, 33, 35, 37, 39, 41, 43, and 45). However, manually doing this for all 70 subjects is tetious and subject to error.
So I tried scripting it using your tutorial @ https://neuroimage.usc.edu/brainstorm/Tutorials/Scripting#Example:_Editing_events
It was very helpful with setting up the skeleton, however, it did not allow for multiple events.
Currently I have:
"
% Find the index of the event category "button"
iEvtCorr = find(strcmpi({sRaw.F.events.label}, or('31,'33', '35', '37', '39', 41', '43', '45')));
% Copy the event category "button" to a new category
iEvtNew = length(sRaw.F.events) + 1;
sRaw.F.events(iEvtNew) = sRaw.F.events(iEvtCorr);
% Rename the new event to "button_offset"
sRaw.F.events(iEvtNew).label = 'Correct3';
nTimes = size(sRaw.F.events(iEvtNew).times, 2);
sRaw.F.events(iEvtNew).epochs = ones(1, nTimes);
sRaw.F.events(iEvtNew).channels = cell(1, nTimes);
sRaw.F.events(iEvtNew).notes = cell(1, nTimes);
% Change the event color to yellow (red=1, green=1, blue=0)
sRaw.F.events(iEvtNew).color = [1 1 0];
% Update the sRaw structure to the RawFile file (the last parameter appends to the existing struct)
bst_save(file_fullpath(RawFile), sRaw, 'v6', 1);
"
This is what I have.
The bolded section is where I tripped up the program. It keeps assigning the error:
"
Unable to perform assignment because the left and right sides have a different number of
elements.
Error in script_new (line 14)
sRaw.F.events(iEvtNew) = sRaw.F.events(iEvtCorr);
"
Any advice would be well received.
Thanks!