- Compute the fraction in each interval to determine the end value wanted, then
- Use that function as the target for retime to reset the time vector.
How can I change time data to 5-minutes intervals?
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Wolfgang McCormack
el 27 de Ag. de 2020
Hello everyone, how can I change time intervals of a binary data (0 and 1) to 5-minutes intervals? [for 5 minutes periods that include both 0 or 1, I want to have the value that has occupied more than 50% of the period; for instance, if 1 was in 10:10 to 10:15 for 3 minutes, then the interval includes the value 1 ]
Here is an example: I have the following time and data
Column 1 Column 2
Aug 27 8:35:37 1
Aug 27 9:47:00 0
Aug 27 9:49:59 1
Aug 27 9:54:50 0
Aug 27 10:35:45 1
I want this data to turn to 5 minutes intervals like this:
Column 1 Column 2
Aug 27 8:35:00 1
Aug 27 8:40:00 1
Aug 27 8:45:00 1
.....
Aug 27 9:45:00 1
Aug 27 9:50:00 0 (Because about 3 minutes in this interval (from 9:45 to 9:50 ) was 0)
Aug 27 9:55:00 1 (because about 4 minutes was 1)
Aug 27 10:00:00 0
Aug 27 10:05:50 0
....
Aug 27 10:35:00 1
Aug 27 10:40:00 1
I am new to Matlab so I really appreciate it if you could provide the code. Thank you in advance!
3 comentarios
VBBV
el 8 de Sept. de 2020
Editada: VBBV
el 8 de Sept. de 2020
Import the timestamp sensor data from excel to a vector,say T
%
%if true
% end
T = [1:00:00 2:00:00 3:00:00...];
D = T(1):minutes(5):T(end);
% creates a vector D with a 5 minute interval data of vector T
Then use the if condition within a loop to assign the binary values to the intervals in the D vector
Respuesta aceptada
VBBV
el 4 de Sept. de 2020
Editada: VBBV
el 7 de Sept. de 2020
Import the timestamp sensor data from excel to a vector,say T
%
%if true
% end
T = [1:00:00 2:00:00 3:00:00...];
D = T(1):minutes(5):T(end);
% creates a vector D with a 5 minute interval data of vector T
Then use the if condition within a for loop to assign the binary values to the intervals
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Timetables en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!