필터 지우기
필터 지우기

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

조회 수: 5 (최근 30일)
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
Guillaume
Guillaume 2016년 6월 16일
편집: Guillaume 2016년 6월 16일
"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 2016년 6월 16일
I want like output a struct (not nested) that have all the sequences with same day and month divided in interval of 2 hours

댓글을 달려면 로그인하십시오.

채택된 답변

Guillaume
Guillaume 2016년 6월 16일
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
Guillaume
Guillaume 2016년 6월 16일
"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)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by