%% Check Deletion of History-Based Logic
% Create a history-based logic. Specify confirmation threshold values Mc and Nc as the vector [2 3]. Specify deletion threshold values Md and Nd as the vector [4 5].

historyLogic = trackHistoryLogic('ConfirmationThreshold',[2 3], ...
    'DeletionThreshold',[4 5])

% Initialize the logic, which records a hit as the first update to the logic. The confirmation flag is false because the number of hits is less than two (Mc).

init(historyLogic)
history = output(historyLogic);
checkConfirmation(historyLogic)
delFlag = checkDeletion(historyLogic);
disp(['History: [',num2str(history),']. Deletion Flag: ',num2str(delFlag)]);

% Update the logic with a hit. The confirmation flag is true because two hits (Mc) are counted in the most recent three updates (Nc).

hit(historyLogic)
history = output(historyLogic);
checkConfirmation(historyLogic)
delFlag = checkDeletion(historyLogic);
disp(['History: [',num2str(history),']. Deletion Flag: ',num2str(delFlag)]);
miss(historyLogic)
history = output(historyLogic);
checkConfirmation(historyLogic)
delFlag = checkDeletion(historyLogic);
disp(['History: [',num2str(history),']. Deletion Flag: ',num2str(delFlag)]);
miss(historyLogic)
history = output(historyLogic);
delFlag = checkDeletion(historyLogic);
checkConfirmation(historyLogic)
disp(['History: [',num2str(history),']. Deletion Flag: ',num2str(delFlag)]);

% Copyright 2019 The MathWorks, Inc.
%