Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
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 comentarios
Guillaume
Guillaume el 16 de Jun. de 2016
Editada: Guillaume el 16 de Jun. de 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 el 16 de Jun. de 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

Iniciar sesión para comentar.

Respuesta aceptada

Guillaume
Guillaume el 16 de Jun. de 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 comentarios
Guillaume
Guillaume el 16 de Jun. de 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)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Parallel for-Loops (parfor) en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by