Hi!
I have a speed vector from a vehicle where i want to identify the stops and how long they are. I managed to create several logic vectors which save the position (index) or mark the index as "0" else "1". However, the logic vector I went with is one which save the vector index if the speed is zero or very close to. Resulting if there´s a longer stop, the index count will be something such as [0;0;0;33;34;35;...;99;100;101;0;0;0]. And I want to use this. So I try to create a final logic which tracks this pattern and calculate the total stop time. I can do that since I know that every data point has the sample 1 [Hz]. Other knowledge is that it data starts and end with a stop.
My logic was, which didn´t work (it runs but gives back unexpected result, nothing useful), the following:
for i = 1:length(index)-1
for j = 2:length(index)
if index(i) > 0 && index(j) > 0
stop_start(i,1) = index(i);
elseif index(i) > 0 && index(j) == 0
stop_end(i,1) = index(i);
end
end
end
stop_time_tot = stop_start - stop_end;
Any ideas on what went wrong? I usually end up like this on ohter similar data sorting problems but never take it further but I want to get better and increase my knowledge...
All the best, Adam.