How to pick data from one set with a condition from another?
Show older comments
I have two sets of data. One represents a sensor measuring CO2, humidity and temperature, while the other logs the opening and closing of the window (in terms of 0 and 1). Both sets of data have a time stamp written by the logger. I have to write a short code that will basically tell me what was the data of the sensor right before the window was open. What I know: I know that I have to create an index which will give me all times when the window was open.
What I don't know #1: How will I create this index, which needs to return me the time when the first 1 appeared, so if I have:
TIME_1 0
TIME_2 1
TIME_3 1
TIME_4 1
TIME_5 0
TIME_6 0
TIME_7 1
TIME_8 1
I only want time TIME_2 and TIME_7.
What I don't know #2: When I manage to extract those time values, how am I going to pick the closest (but smaller) value for the whole array?
I hope my question is understandable, I really appreciate your help!
Accepted Answer
More Answers (0)
Categories
Find more on Matrix Indexing 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!