It looks like you want the union of closed intervals. Here is some code that I think does the job. When the ends of intervals have the same value, it works because the sort function is stable and preserves ordering for ties.
I want to mention that poposed solution is very nice, but I remember that it has some kind of a bug. I can not point in which case, but I faced it in my project which I was doing that times. My solutions is slower but did not gave an error.
You can use any solution you want, but consider what I said.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
댓글 수: 1
이 댓글에 대한 바로 가기 링크
https://kr.mathworks.com/matlabcentral/answers/366626-overlapping-time-intervals#comment_504006
이 댓글에 대한 바로 가기 링크
https://kr.mathworks.com/matlabcentral/answers/366626-overlapping-time-intervals#comment_504006
댓글을 달려면 로그인하십시오.