Finding values of a response within range of a cue
Ältere Kommentare anzeigen
I have a matrix of two columns. The first column is cue times, as in times an animal was cued to do something. The second column is times that the animal responded. If the animal correctly responded then the animal will respond within a range of .15 seconds of cue and less then 5 seconds from cue. If so this is a correct behavior and needs to go into one matrix, if not then this is an error behavior and needs to go in another matrix.
This is the code I have written, but I am not sure why exactly it is not working.
Here is my code:
data=intervals;
cue=data(:,1);
response=data(:,2);
for k=1:length(cue)
for i=1:length(response)
if cue(k)+.15 >= response(i) && cue(k)+5<= response(i)
correct(i)=response(i);
else
error(i)=response(i);
end
end
end
I attached an example matrix of intervals.
Any help would be greatly appreciated.
3 Kommentare
per isakson
am 1 Dez. 2016
Bearbeitet: per isakson
am 1 Dez. 2016
- In what way does the code fail?
- What is the expected behavior?
- What is the unit of the data in intervals.mat
James Tursa
am 1 Dez. 2016
Note: error() is the name of a MATLAB intrinsic function. You should choose another name for your variable.
Krispy Scripts
am 1 Dez. 2016
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Audio and Video Data finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!