フィルターのクリア

Find specific datenum in Matrix

1 回表示 (過去 30 日間)
David du Preez
David du Preez 2017 年 6 月 8 日
編集済み: Andrei Bobrov 2017 年 6 月 8 日
Hi. I have a 14x14 (A)matrix.In column 1 are datenum values corresponding to a random hour of a day. I want to use these datenum values to find the hourly data in a much larger matrix(B) and then create a new matrix with the hourly data using the dates from A. So the new matrix should be 336x14

採用された回答

David du Preez
David du Preez 2017 年 6 月 8 日
編集済み: Andrei Bobrov 2017 年 6 月 8 日
% extract dates
dates = datevec(SON_CS2_lowTCO(1:14,1));
% Remove h,m,s
dates = dates(:,1:3);
dates23 = dates;
% Add end of day to matrix
dates23(:,4)=23;
dates23(:,5)=0;
dates23(:,6)=0;
for i=1:14
findA2 = CS2_All(:,1) >=datenum(dates(i,1:3)) & CS2_All(:,1)<= datenum(dates23(i,1:6));
A2(24*i-23:24*i,:) = CS2_All(findA2,:);
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by