How to add a time delay using FOR and IF loop for logical vectors?

1 view (last 30 days)
Hi,
I have a logical vector which is from the output of a motion sensor "Motion_1" used in an experiment. it is "1" if motion is detected and "0" if no motion is detected. I want to create a process for where I can model different time delays. for this is have created a logical vector of all "1" "Five_min_delay" which equate to five minutes from my experiment. The trouble I am having is I want to scan through the "Motion_1" vector and when it becomes high "1" I want to add the "Five_min_delay" into it so this simulates the sensor being "1" for five minutes. As well as this I need to re-trigger the time delay every time "Motion_1" becomes High "1" within that time delay. I hope this makes sense? does anyone have an appropriate solution to this? Please query any of my question if not fully understood. Thanks in advance, Adam

Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!