Effacer les filtres
Effacer les filtres

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

1 vue (au cours des 30 derniers jours)
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 commentaires
Samantha Wallace
Samantha Wallace le 12 Juil 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

Connectez-vous pour commenter.

Réponses (1)

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

Catégories

En savoir plus sur Dates and Time dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by