Azzera filtri
Azzera filtri

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

1 visualizzazione (ultimi 30 giorni)
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 Commenti
Samantha Wallace
Samantha Wallace il 12 Lug 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

Accedi per commentare.

Risposte (1)

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

Categorie

Scopri di più su Dates and Time in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by