traj_cnt = 0;
t_row_cnt = 0;
m_row_cnt = 0;
global_TP = 0;
global_FN = 0;
global_FP = 0;
global_TN = 0;
error_cnt = 0;
motorspeed_detected(length(Traj_interpl)) = 0;
motor_actual(length(M_interpl)-1) = 0;
var = 2;
harm = 10;
TP_help = 0;
FN_help = 0;
FP_help = 0;
TN_help = 0;
TN_debug = 0;
TP=0;
FN=0;
FP=0;
TN=0;
motor_detection_cnt = 0;
for t_ref_cnt = 385
for m_interpl_cnt = 2:length(M_interpl)
for m_row_cnt = 1:length(M_interpl{m_interpl_cnt})
if t_ref(t_ref_cnt) == M_interpl{1}(m_row_cnt)
motor_actual(m_interpl_cnt-1) = M_interpl{m_interpl_cnt}(m_row_cnt);
break;
else
motor_actual(m_interpl_cnt-1) = 0;
end
end
end
for traj_cnt = 1:length(Traj_interpl)
for t_row_cnt = 1:length(Traj_interpl{traj_cnt})
if t_ref(t_ref_cnt) == Traj_interpl{traj_cnt}(t_row_cnt,1)
motorspeed_detected(traj_cnt) = Traj_interpl{traj_cnt}(t_row_cnt,2);
break;
else
motorspeed_detected(traj_cnt) = 0;
end
end
end
if (any(motor_actual))
for m_act = 1:length(motor_actual)
for s_act = 1:length(motorspeed_detected)
for harm = 1:10
for tube = var
if (any(motorspeed_detected))
if (motorspeed_detected(s_act) >= (motor_actual(m_act) * harm) - tube) && (motorspeed_detected(s_act) <= (motor_actual(m_act) * harm ) + tube)
global_TP = global_TP + 1;
TP_help = TP_help + 1;
elseif (motorspeed_detected(s_act) > ((motor_actual(m_act) * harm) + tube) && (motorspeed_detected(s_act) < ((motor_actual(m_act) * (harm + 1)))- tube))
global_FN = global_FN + 1;
FN_help = FN_help + 1;
else
end
elseif (~any(motorspeed_detected))
global_FN = global_FN + 1;
FN_help = FN_help + 1;
else
end
end
end
end
end
elseif (~any(motor_actual))
if (any(motorspeed_detected))
global_FP = global_FP + 1;
FP_help = FP_help + 1;
elseif (~any(motorspeed_detected))
global_TN = global_TN + 1;
TN_help = TN_help + 1;
TN_debug(TN_help)= t_ref_cnt;
else
end
else
end
if (TP_help >= 1) || (TP_help >= 1 && FN_help >= 1)
TP = TP + 1;
elseif FN_help >= 1 && TP_help == 0
FN = FN + 1;
elseif (FP_help >= 1)
FP = FP + 1;
elseif (TN_help >= 1)
TN = TN + 1;
else
error_cnt = error_cnt + 1;
end
TP_help = 0;
FN_help = 0;
FP_help = 0;
TN_help = 0;
end