Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- inTime = cumsum(rand(100,1)); %They show up randomly
- outTime = inTime + rand(100,1) + 0.25; % Stay for 0.25 to 1.25 hrs
- inCount = ones(size(inTime)); %Add one for each entry
- outCount = ones(size(outTime))*-1; %Subtract one for each exit.
- allTime = [inTime; outTime]; %Stick them together.
- allCount = [inCount; outCount];
- [allTime, idx] = sort(allTime);%Sort the timestamps
- allCount = allCount(idx); %Sort counts by the timestamps
- allCount = cumsum(allCount); %total at any given time.
- plot(allTime,allCount);%total at any given time.
Add Comment
Please, Sign In to add comment