필터 지우기
필터 지우기

Wanting to analyze only data taken from days at night from a matrix of data from roughly a week

조회 수: 1 (최근 30일)
I have approximately a weeks worth of data (column 1 is date/time data in 30 second epochs and column two is the corresponding integer value for the date/time). I want to keep the entire data set (specifically date/time) for plotting purposes later on, but I only want to analyze the data in a function from 7pm to 10am on each day. Any recommendations on how to do this?
  댓글 수: 4
Samantha Wallace
Samantha Wallace 2018년 7월 12일
I've tried many codes but in general the code below follows the format I've been trying most I think. It's pretty messy but I'm just stuck in a rut of how to make this work the way I am needing it to.
idx = strcmp(DT3_30str,{'19:00:15'});
[timeidx_7pm,~] = find(idx == 1);
idx = strcmp(DT3_30str,{'10:00:15'});
[timeidx_10am,~] = find(idx == 1);
for ii = 1:size(timeidx_7pm)
if Sampledata(timeidx_7pm(ii):timeidx_10am(ii))
Sampledata(ii,2) = Sampledata(ii,2);
else
Sampledata(ii,2) = {'DayTime'}; % or equal to rally anything as a place holder so I can still have the datetime value for plotting later
end
end

댓글을 달려면 로그인하십시오.

답변 (1개)

Steven Lord
Steven Lord 2018년 7월 12일
If your time and date data is stored as a datetime array, call hour on that datetime array.

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by