Effacer les filtres
Effacer les filtres

Matlab: organize a great number of data based on month, day and hourly intervals

1 vue (au cours des 30 derniers jours)
Hi! I have a problem and I'm not able to find a smart solution. I explain it in short: I have a great number of user's sequence of location records and I have clustered them with cluster alghoritm optics. After find the cluster, I find the sequences of location records in every cluster. They are included in SetOfDataset (attached) end that is a struct 1x50, where 50 is the number of the cluster. Every sequence of locations has = [userId year month day hour minutes seconds latitude longitude locationID]
I want to divide this sequences based on month, day and, after identified the days, I want to divide them in intervals of 2 hours.
I have try to use nested struct but the code is terrible: slow, not clear the results... I want to do something of easy but I can't find smart ideas: can you help me?
  2 commentaires
Guillaume
Guillaume le 16 Juin 2016
Modifié(e) : Guillaume le 16 Juin 2016
"I want to divide this sequences based on month, day and, after identified the days, I want to divide them in intervals of 2 hours."
So what sort of output are you looking for for a given cluster?
elisa ewin
elisa ewin le 16 Juin 2016
I want like output a struct (not nested) that have all the sequences with same day and month divided in interval of 2 hours

Connectez-vous pour commenter.

Réponse acceptée

Guillaume
Guillaume le 16 Juin 2016
It's not clear what final output you're looking for. Something like this:?
for setidx = 1 : numel(SetOfDataset)
points = SetOfDataset(setidx).points;
%divide date/hour in groups of two hours:
[~, ~, dateid] = unique([points(:, 2:4), floor(points(:, 5)/2)], 'rows', 'stable'); %'stable' optional
%use that to split the point array into cell arrays
SetOfDataset(setidx).splitpoints = arrayfun(@(did) points(did == dateid, :), [1:max(dateid)]', 'UniformOutput', false);
end
  3 commentaires
Guillaume
Guillaume le 16 Juin 2016
"I want also to divide the hours associated to every day in intervals of 2 hours"
It is doing this already. That's the purpose of the floor(points(:, 5)/2)
elisa ewin
elisa ewin le 16 Juin 2016
sorry, I haven't noted this. Thanks

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Parallel for-Loops (parfor) 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