Inserting zeros between two rows in an array
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Walter Roberson
2012-6-26
3 个评论
Walter Roberson
2012-6-26
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dates and Time 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!