I have 1D arrays, one is labelled start_event, and one labelled end_event. The start_event array marks the index at which an event in another array starts. This has been subjected to other filters, so that the end_event array no longer matches. What I need to do would be to get the value at index i in end_event where it is the highest possible value that is still smaller than start_event(i+1), i.e. the events should not overlap, but should run as long as possible. An example:
start_event= 2 212 260 284 472 560end_event=561084175183258266271324493523576
What I would then like as an output for filtering end_event is
end_event=183258271324523576
That way, each event is closed in itself and has the maximal span available in the unfiltered end_event data.
I have tried it like this, but obviously something is wrong because my output is a long list of zeros with 1s thrown in:
for i=1:length(start_event)-1 for k=1:length(end_event) end_event_f(k)=max(end_event(end_event(k)>start_event(i) && end_event(k) < start_event(i+1))); endend
I'd appreciate any help!
Best Answer