Path: news.mathworks.com!not-for-mail From: "Theodor Zouk" <rebet4@hotmail.com> Newsgroups: comp.soft-sys.matlab Subject: Find indices where overlapping intervals occurs Date: Tue, 1 Nov 2011 07:33:29 +0000 (UTC) Organization: Univ of Umea Lines: 19 Message-ID: <j8o7c9$m9m$1@newscl01ah.mathworks.com> Reply-To: "Theodor Zouk" <rebet4@hotmail.com> NNTP-Posting-Host: www-05-blr.mathworks.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: newscl01ah.mathworks.com 1320132809 22838 172.30.248.37 (1 Nov 2011 07:33:29 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Tue, 1 Nov 2011 07:33:29 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 1540208 Xref: news.mathworks.com comp.soft-sys.matlab:747807 Hello! Im having a problem getting the indices (integers) from overlapping intervals. Let me explain: let's say for instance that I have some intervals belonging to say set A: [1,3] [5,8] [11,12] set B: [4,6] [8,10] The indices(integers), where the intervals of set A overlaps with intervals of set B could easily be found by using the matlab "intersect" function after constructing the intervalls to vectors. Now this is not an option to me due to my intervals could hold a couple of hundred millions elements (integers) if made to vectors, so i just have to work with the the start and end values for each intervall. I should mention that all my intervals are closed intervals and positive integers. I have tried to use nestled loops but get lost in translation such of speech... Im wondering if there exists some solution (maybe mathematical formula) to find the indices(integers) where intervals overlaps based only on the start and end values. Best regards Teo