The thread started with a short translation from Matlab to Julia of arrays’ indexing, and seems to have turned into a full review of 400 lines of code.
The best practice is to provide minimum working examples (MWE): please check this PSA.
In my opinion, once the initial question has been answered, it is not always wise to add a lot of new ones, and certainly not to add 400 LOCs, but rather to create a new thread. Thank you.