09-23-2016 12:42 PM
I need that to be sure all elements are processed in the worst case.
09-23-2016 12:46 PM
@Mmehrabin wrote:I need that to be sure all elements are processed in the worst case.
You should use a while loop and stop when you run out of elements. You still have not explained the algorithm.
09-23-2016 12:53 PM - edited 09-23-2016 12:53 PM
09-23-2016 12:54 PM
Two text files are the time of rising edge two separated ones and I want to detect the latency between signal1 and signal2 (Ther are already sorted). So I transfer them into two arrays and check the first element of them. If the signal2 element is greater than signal1, it should be removed from signal2, if they are equal, both should be removed in case of the greater, signal1 should be removed and so on.
09-23-2016 12:56 PM
You do that for the first element.
Once that is done, do you care about later elements in the arrays?
09-23-2016 12:58 PM
Do you need the leftover pieces once things are removed or do you just need it for the processing?
09-23-2016 01:01 PM
@Mmehrabin wrote:Two text files are the time of rising edge two separated ones and I want to detect the latency between signal1 and signal2 (Ther are already sorted). So I transfer them into two arrays and check the first element of them. If the signal2 element is greater than signal1, it should be removed from signal2, if they are equal, both should be removed in case of the greater, signal1 should be removed and so on.
You have not explained the middle shift register where you buld an array.
It would be much easier to explain it with an example.
09-23-2016 01:01 PM
I do not need them
09-23-2016 01:02 PM - edited 09-23-2016 01:03 PM
@Mmehrabin wrote:I do not need them
OK, no need to chop up the array. Just keep track of the current index.
Does the code currently work as desired? What result would you expect for array5 given the example files.
09-23-2016 01:28 PM
It works now. Thank you