Hello,
How can I analyze only the hit trials using the Offline Analysis tool? I don't know how to take out the trials that did not hit the target or single out the ones that did. Is there a way I can delete the non-hit trials from the .dat file and then import that into the Offline Analysis tool?
Thanks
Offline analysis: look at only hit trials
Re: Offline analysis: look at only hit trials
Catalina,
whether a trial was a hit or a miss depends on evaluating whether the ResultCode equals the TargetCode. While TargetCode is set throughout the trial, the ResultCode is only known for a brief time after the target was hit, missed or the trial timed out [1]. Because of this you can't easily use this as an expression in the Offline Analysis tool.
As a workaround, you could use load_bcidat [2] to read the data into MATLAB and to create a new state that for the duration of the TargetCode is filled with the ultimate result of this trial. You then use save_bcidat [2] to save this again as a BCI2000 data file. After this you can evaluate your new state in OfflineAnalysis together with the TargetCode.
Let me know if this works for you.
Regards, Peter
[1] http://www.bci2000.org/wiki/index.php/U ... k#Timeline
[2] http://www.bci2000.org/wiki/index.php/U ... _MEX_Files
whether a trial was a hit or a miss depends on evaluating whether the ResultCode equals the TargetCode. While TargetCode is set throughout the trial, the ResultCode is only known for a brief time after the target was hit, missed or the trial timed out [1]. Because of this you can't easily use this as an expression in the Offline Analysis tool.
As a workaround, you could use load_bcidat [2] to read the data into MATLAB and to create a new state that for the duration of the TargetCode is filled with the ultimate result of this trial. You then use save_bcidat [2] to save this again as a BCI2000 data file. After this you can evaluate your new state in OfflineAnalysis together with the TargetCode.
Let me know if this works for you.
Regards, Peter
[1] http://www.bci2000.org/wiki/index.php/U ... k#Timeline
[2] http://www.bci2000.org/wiki/index.php/U ... _MEX_Files
Re: Offline analysis: look at only hit trials
Thank you very much. I was wondering if you could help me with filling in the new states variable. I don't have very good matlab skills and I would really appreciate it. I was able to create a new states variable but I can't figure out how to fill it with the information I need.
Thank you
Thank you
Re: Offline analysis: look at only hit trials
Catalina,
please see the code below.
Regards, Peter
please see the code below.
Regards, Peter
Code: Select all
clear all
close all
addpath('~/mex/');
filename = 'filename.dat';
[ signal, states, parameters ] = load_bcidat(filename);
%%
figure,
plot(states.TargetCode,'b-'), hold on,
plot(states.ResultCode,'r--'), axis tight;
%%
index_trial_start = find(diff(double(states.TargetCode)) > 0)+1;
index_trial_stop = find(diff(double(states.TargetCode)) < 0);
if length(index_trial_stop) < length(index_trial_start)
index_trial_stop = [index_trial_stop;length(states.TargetCode)];
end
for idx_trial = 1:length(index_trial_start),
states.ResultCode(index_trial_start(idx_trial):index_trial_stop(idx_trial)) = states.ResultCode(index_trial_stop(idx_trial));
end
%%
figure,
plot(states.TargetCode,'b-'), hold on,
plot(states.ResultCode,'r--'), axis tight;
Re: Offline analysis: look at only hit trials
Great! It worked! Thank you so much for all of your help
Who is online
Users browsing this forum: No registered users and 23 guests