Inserting zeros between two rows in an array
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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.
0 commentaires
Réponse acceptée
Walter Roberson
le 26 Juin 2012
3 commentaires
Walter Roberson
le 26 Juin 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.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Dates and Time dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!