MATLAB Answers


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

Asked by Emanuele Massaro on 9 Jul 2015
Latest activity Commented on by Emanuele Massaro on 9 Jul 2015
Hello everybody, I would like to make a question. I have the array Z with
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.


Z(:,4) - interval of time (in hours or minutes)?
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?

Sign in to comment.

0 Answers