Inserting zeros between two rows in an array

1 visualización (últimos 30 días)
Swasti Khuntia
Swasti Khuntia el 26 de Jun. de 2012
I've an array of date and time {1 month} in 1 column and some data in another column. The data is for 30 days but it's from time 08:00:00 till 21:59:00. I want to insert zeros in the time frame 22:00:00 to 07:59:00.
Any ideas/solutions are highly obliged. Thanks !!!!!
More INFO: For e.g., in January, there are (31x24x60=44640) minutes. But I don't have data for every minute. So, I want to enter a '0' for the unavailable data. So, that in the end I have 44640x2 array.

Respuesta aceptada

Walter Roberson
Walter Roberson el 26 de Jun. de 2012
You can create the list of times using addtodate
  3 comentarios
Walter Roberson
Walter Roberson el 26 de Jun. de 2012
Separate your two columns into two arrays. reshape() each so that the number of rows is the same as the number of entries per day that you actually have. vertcat() on the addate() results to the date array. vertcat() a zero() of the appropriate size to the data array. reshape each of them back to one column. horzcat() the two columns together.
Swasti Khuntia
Swasti Khuntia el 26 de Jun. de 2012
Hello Walter, I'm extracting my data from an Excel file. Hence, the char and num rows are stored separately in two arrays. How can I insert date & time and '0' in between 2 time-frames? Like, for the first day, the data ends at 21:59:00 and it starts the next day at 08:00:00. So, I want to insert the time date/time like
22:01:00 0
22:00:00 0
.
.
.
.
07:59:00 0
And, then again the data starts.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Matrices and Arrays 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!

Translated by