EEG data, tried three different ways and end up with same subsindex error
Show older comments
I am writing a code that replaces values around an EEG data file where there is a 9, it changes the values (4 to the left and 7 to the right) to 5:16 for option 2 and for option 3, it would look for number 59 and replaces values around it from 58 to 63.
function OUTEEG = FormatEEGarry(EEG,option)
x= pop_loadset;
optionChoose = inputdlg('What option do you want?:', 'Option input',[1,30])
option = str2num(optionChoose{:}); %option chosen and stored
search_9 = find([x.event.epochtype]==9);
search_59 = find([x.event.epochtype]==59);
if option ==1
for k=1:size(x.event,2)
temp= x.event(k).epochtype
if [x.event(k).epochtype] ~=1;
x.event(k).epochtype =99;
end
disp([temp x.event(k).epochtype])
end
end
if option ==2
for ii= 1:size(search_9);
temp= x.event(ii).epochtype;
if (search_9(ii)+7) <= size([x.event.epochtype],2)
if (search_9(ii)-4) >= 1
ringa = search_9(ii) + [-4:7];
[x.event(ringa).epochtype]= 5:16;
end
end
disp([temp x.event(ii).epochtype])
end
end
i keep getting an error for the line
[x.event(ringa).epochtype]= 5:16;
and the error is Undefined function or variable 'ringa'.
Error using subsindex Function 'subsindex' is not defined for values of class 'struct'.
An alternative choice for option 2 that i used is as follows,
if option ==2
temp = x.event(ii).epochtype
Z = +regexprep(char(x.event.epochtype),sprintf('.{0,4}%c. {0,7}',9),char(5:16))
disp([temp x.event(k).epochtype])
end
This seems to do half the job and changes the data around 9 to 1 1 1 9 10 11 12 1 1 1. Which is not quite there yet.
I am not really sure what to do here??
Accepted Answer
More Answers (0)
Categories
Find more on EEG/MEG/ECoG in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!