Please note: MATLAB allows positive array indices only, examples
Whatever you do during array indexing, please make sure that within "()", there should be a positive integer values only such as 1,2,3,….
In the code, as you have shared, in the first iteration of the loop
For the iteration, once the "j" reach to 67, then "if condition" becomes true, in that case:
Hope you get the points of error. Hence requested to do the coding in such a way that, which only generates positive values with array indexing.