Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
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 Kommentare
Samantha Wallace
Samantha Wallace am 12 Jul. 2018
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

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Steven Lord
Steven Lord am 12 Jul. 2018
If your time and date data is stored as a datetime array, call hour on that datetime array.

Kategorien

Mehr zu Dates and Time finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by