How to pick data from one set with a condition from another?
Mostra commenti meno recenti
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!
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Matrix Indexing in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!