Event resorted by increasing latencies. Some event indices have changed...ARRRRRRR

1 次查看(过去 30 天)
Hey guys, i have been working on this project for the last couple of months and i am just bringing all the pieces together to finally put this to rest.However, i am coming across this error that i just can't seem to fix. The code is as follows, i will try my best to convey the scripts called in the code that i can't post for brevity.
function EEG = chronos(cntLoad, data_isol)
%cntLoad loads cnt files in a loop, and data_isol is the data that is isolated from a text
file that contains data for subjects collected after their
EEG runs, a few hundred subjects.
%I am getting this part of the code by parsing through a text files that has data. It has
three columns and varying number of rows depending on the subject whose tests
yielded those results. The first column is the begin_trigger, the second is end_trigger,
the last is the difference of the first two columns. I am not attaching code from the other
script, because that would only complicate the question.However, i will try to explain the basic
function of each script and code.
begin_trigger = data_isol(:,1,1); %isoltes the indices where the trigger appeared
end_trigger = data_isol(:,2); %isolates the indices where the subject reacted
latent_time = data_isol(:,3); % takes out the the third column of the data table. This is the time of the reaction after trigger
cntLoad.event(find([cntLoad.event.type] == 2)) = [];
cntLoad.event(find([cntLoad.event.type] == 3)) = [];
CNT = cntLoad; %cntLoad is coming from master_script.m. It is defined
%there with the pop_loadcnt function in a loop.
counter=1;
%the following pop_editeventvals code syntax could be extracted by loading the CNT %file in EEGLAB UI the go to Event values UI to edit event values
for j= 1:size(begin_trigger,1)
CNT = pop_editeventvals(CNT,'append',{end_trigger(j)+counter-1 [] [] []},...
'changefield',{end_trigger(j)+counter 'type' 92},...
'changefield',{end_trigger(j)+counter 'latency' (cntLoad.event(begin_trigger(j)+counter-1).latency...
+ latent_time(j))/1000});
counter = counter +1;
end
When i run this code, it displays this message while running this code:
Event resorted by increasing latencies. Some event indices have changed.
This keeps changes the resulting output events fields and keeps moving the latencies being ahead from where they should be added. Any ideas to fix this. Am i placing the counter wrong?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 EEG/MEG/ECoG 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by