How to keep TRUE if followed by FALSE but if TRUE is followed by TRUE, change the second TRUE to false?
3 ビュー (過去 30 日間)
I have an array of logic 1 and 0's.
If 1 is immediately followed by another 1, I want to change this second 1 to a 0.
trial_index = zeros(size(trial)+1);
for i = 1: length(trial)
if trial(i) == 1
strial_index(i) = 1;
trial_index(i) = 0;
if trial(i+1) == 1
trial_index(i+1) = 0;