How can I use accumarray in order to evaluate the place where users spend most of their time?

2 ビュー (過去 30 日間)
Hello everybody, I would like to make a question. I have the array Z with
Z(:,1)=USER_ID
Z(:,2)=PLACE
Z(:,3)=DATE
Z(:,4)=TIME
For each user I compute the most visited location as
% L = accumarray(Z(:,1),Z(:,2),[max(Z(:,1)) 1],@mode);
How can I evaluate the location in which users spend most of their time? For each location visited by each user I should evaluate the timespan in days and then choose the location where this timespan is maximum.
Thanks for your support.
  2 件のコメント
Andrei Bobrov
Andrei Bobrov 2015 年 7 月 9 日
Z(:,4) - interval of time (in hours or minutes)?
Emanuele Massaro
Emanuele Massaro 2015 年 7 月 9 日
Z(:,4) is in form of "hhmmss". But for now I just care about the timespan in days Z(:,3). I am doing
L1 = accumarray(Z(:,1:2),Z(:,4),[max(Z(:,1)) max(Z(:,2))],@sum);
What do you think?

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeTables についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by