フィルターのクリア

Inserting zeros between two rows in an array

1 回表示 (過去 30 日間)
Swasti Khuntia
Swasti Khuntia 2012 年 6 月 26 日
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.

採用された回答

Walter Roberson
Walter Roberson 2012 年 6 月 26 日
You can create the list of times using addtodate
  3 件のコメント
Walter Roberson
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.
Swasti Khuntia
Swasti Khuntia 2012 年 6 月 26 日
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.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by