Hi @Marco Montanaro,
Here's an example script that demonstrates how to implement this custom verification delay in Matlab:
function customVerifyEqual(A, E)
% Set the time delay in milliseconds
delayTime = 3; % 3 milliseconds
% Check if A is equal to E after a time delay
tic; % Start timer
while toc * 1000 < delayTime
if isequal(A, E)
disp('Test Passed: A is equal to E within the time delay.');
return;
end
end
% If A is not equal to E within the time delay
error('Test Failed: A is not equal to E within the time delay.');
end
% Example usage
A = 10.5; % Actual value
E = 10.5; % Expected value
% Call the custom verification function
customVerifyEqual(A, E);
So, in this script, the verifyfunction takes two input arguments A (Actual value) and E (Expected value) and compares the values and wait for the specified time delay using a while loop and the tic and toc functions. If the values match within the time delay, it displays a message indicating the test passed and if they do not match within the time delay, it throws an error indicating the test failed. You can adjust the delayTime variable to set the desired time delay in milliseconds according to your requirements. Hope, this answers your question. Please let me know if you have any further questions. Please see attached results.