How do track a video and make the alarm run after 10 s the occurrence of a condition, but after making sure that the condition is still happen without off displaying?

2 views (last 30 days)
%%need to catch CL and then check if still CL there run alarm or do check again without pause or stop the displaying:
%%the two code does't working well where the alarm is run but the displaying is pause
out = (labels);
out = out(1,1)
first code :
% initTime = clock;
% newTime = initTime;
% for out='CL'
% if newTime(6)-initTime(6)==10
% [a,fs] = audioread ('1003.wav');
% sound(a(1:100000),fs);
%
%
% end
% newTime = clock;
% end
secounde code:
if out == 'CL'
tic;
pause (10);
if out == 'CL'
[a,fs] = audioread ('1003.wav');
sound(a(1:100000),fs);
elseif out ~= 'CL'
reset(tic);
end
end
  1 Comment
Geoff Hayes
Geoff Hayes on 16 Dec 2021
@abubaker alasfer - how is the condition determined? How is out determined? If on the first occurrence of out being "CL", then you could start a ten second timer to see that if, after the timer expires, that "CL" is still true, then sound the alarm.
Note when comparing strings you will get errors when using ==. You should be using strcmp or strcmpi instead.

Sign in to comment.

Answers (0)

Categories

Find more on MATLAB Coder in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!